Alexander Neil, 29, pounced on his 31-year-old victim, dragged her into bushes and placed a screwdriver at her neck before sexually assaulting her in September 2012.
He had followed the woman in his car before attacking her in an unlit piece of land close to a road.
Neil, who has previous convictions for road traffic offences, was caught after police found his DNA on the woman, while a glove left at the scene contained his DNA and that of his victim.
A former friend of his told the jury the glove was one of a pair Neil had borrowed from him.
Neil, from Dumfries, had been convicted of rape at the High Court in Glasgow last month and appeared at the High Court in Edinburgh yesterday for sentencing.
Temporary judge Kenneth Maciver told Neil he subjected his victim to a "vicious" and "violent" assault.
Ordering that he be supervised for three years following his release from prison, judge Maciver added: "You emerged from the darkness and assaulted her in a most vicious and violent way and she suffered the most horrifying ordeal.
"The effects of this attack have just not affected her but her family as well."
The attack took place last September 9 on the A711 Dumfries to Dalbeattie Road.