Thomas Shaw,61, attacked the teenager at a location in West Lothian on an occasion between March and April 2014.
The High Court in Edinburgh heard on Wednesday how the pervert had been drinking at the time of the offence.
However, police learned what Shaw had done and he was arrested.
Shaw, of Armadale, West Lothian, pleaded guilty to rape at the High Court in Glasgow earlier this month. Sentence had been deferred for the court to obtain reports about his character.
Passing sentence, judge Lord Bracadale told Shaw that jail was the only sentence available to the court.