Ross Muir, 36, claimed the girl had pretended to be older when they made contact through social media.
He picked her up in Wester Hailes and drove around before returning there and attacking her.
Muir had earlier denied raping the girl on 10 or 11 October in 2015 but was found guilty. He was placed on the sex offenders register indefinitely.
Muir, from Musselburgh in East Lothian, was convicted at the High Court in Edinburgh in March. Sentence had been deferred.
A judge told Ross Muir that his behaviour was "predatory" and added: "There is no doubt you knew the girl was under age."
Lord Boyd of Duncansby said first offender Muir continued to deny the offence and as a consequence showed no remorse.
The former Inland Revenue and Scottish Widows employee appeared to have been taking legal high drugs but the judge said he did not know whether that had anything to do with his offending.
Lord Boyd said Muir had told his earlier trial an "absurd" story to explain the presence of forensic evidence.
Muir subjected the girl to a painful assault. The girl, now aged 13, had to relive her ordeal at the court after he denied raping her.
He was convicted of phoning her and inducing her to meet him in October 2015 and get into his car before kissing her, exposing himself, getting her to perform a sex act on him, pushing her from the front of the vehicle to the back seat and raping her.
DNA matching Muir was found on samples taken from the girl's body and clothing.
Det Ch Insp Martin MacLean, of Police Scotland, said: "This was a significant and serious case where an older man used social media to pretend to be someone he was not and lure his victim out of the safety of her home.
"He made out he was the same age as his victim to take advantage of her youth and innocence and subject her to a harrowing ordeal, the effects of which are likely to be borne by her for the rest of her life.
"I would once again like to commend her courage in coming forward and in giving evidence against Muir which helped to secure his conviction."
A man has been jailed for eight years for raping an 11-year-old girl in his car near her Edinburgh home.