Nabil Romero Bowers, 19, had sex with the schoolgirl at a house in Peterhead on one occasion between March 1 and June 30, 2013.
Judge Lord Turnbull told Bowers: "You have pled guilty to an act of sexual intercourse with a girl who had just before this reached her 12th birthday. Parliament categorises this as rape."
Lord Turnbull said that if it had not been for his age, lack of record and good work history he would have sentenced Bowers to two years' detention.
The High Court in Glasgow heard that Bowers told a social worker the girl had led him on.
Defence solicitor advocate Shahid Latif said: "This was a gross error of judgment on his part. However, when he was asked to stop by the girl as he had sex with her, he stopped."
When Bowers, of Viking Way, Peterhead, was questioned by police he admitted having sex with her.
He said he stopped when she said it was painful and that he believed she was 14.