Warren Gillespie, 41, carried out the attack at a house in Portlethen in September 2014.
Judge Kenneth Maciver QC told the High Court in Edinburgh it was a "nasty and serious" offence.
Police Scotland said: "Gillespie targeted a vulnerable young girl and has been held accountable for his actions."
Former supermarket worker Gillespie, of Bucksburn, Aberdeen, was also placed on the sex offenders register.
The judge said it was clear from an impact statement that the crime had significantly impacted on the victim and was likely to continue to do so for a long time.
He said: "It is inevitable that a lengthy custodial sentence requires to be imposed in this case in order to address the gravity of the issues involved."
The judge said he was prepared to deduct one year from the sentence he would have imposed because, although Gillespie had made a late guilty plea, the victim did not have to give evidence.
He also ordered that Gillespie should be kept under supervision for a further two-year period after his release.
Handcuffed Gillespie made a one-finger gesture to those in the public benches of the court as he was led from the dock.
Defence counsel David Moggach told the court: "For whatever reasons he allowed himself to act in the manner that he did and, of course, he knows that was wrong."
Det Sgt Barry Stewart said: "Gillespie's victim should be commended for having the courage to come forward and report his actions.
"Such actions are absolutely unacceptable and will not be tolerated.
"We hope that this sentence will bring some form of closure for his victim and that she can now move on with her life."
A man who admitted raping a girl aged 12 in Aberdeenshire has been jailed for seven years.