Zack Thompson, 20, had argued he was not in control of his actions while raping the teenager in a Portuguese holiday resort in 2009, and claimed to have no memory of what happened.
But, after police called in sleep disorder psychologists to assess the claims, his defence was rejected and he pleaded guilty to rape.
He has now been sentenced to six years in prison at Nottingham Crown Court.
It is the first time the sleepwalking defence has ever been successfully challenged in England, and only the second ever in Britain.
Detective Constable Paula Winfield, who led the investigation, said: "Sleepwalking as a criminal defence had never been successfully challenged in a sexual offence case before.
"Today has been a triumph for the British legal system."
During a sentencing hearing yesterday (Thurs), prosecutor Dawn Pritchard told the court Thompson had been 18 when visited Albufeira, Portugal, on September 12, 2009 and had drunk seven or eight pints before raping his victim.
The girl, who cannot be named for legal reasons, flew home immediately after the attack and reported it to the police.
Thompson, from Newark, Nottinghamshire, later handed himself in and confessed to a sexual encounter, but told officers he had been sleepwalking and had no memory of what had happened.
When asked if he had raped her, the court heard, he said: "I can't remember, maybe."
Nottinghamshire Police sought guidance from experts about the condition and invited sleep disorder expert Professor Mark Pressman to assess him.
The American psychologist, who has more than 30 years experience with sleep-related disorders, found Thompson behaviour was not consistent with the actions normally displayed by sleepwalkers.
He added that his alleged memory loss was instead "highly likely" to have been the result of drinking excess alcohol.
On hearing the assessment, Thompson withdrew his sleepwalking defence and went on the claim he was "insane".
This too was rejected by an experienced psychiatrist.
After two-and-a-half years, Thompson finally pleaded guilty to rape at Nottingham Crown Court on March 1 this year and has now been sentenced to jail.
Judge John Milmo QC told the court he could not rule out the possibility that his amnesia was genuine but said the crime had a devastating effect on the victim.
He said: "She said 'I did nothing wrong', and she was absolutely right.
"I only hope that today will mark an occasion when she can go back to being the happy young girl she used to be."
Miss Pritchard told the court the girl had found the experience "devastating and humiliating".
She said: ""For the past two and a half years she's had to cope with what happened to her and waiting for this matter to resolve has been very difficult for her.
"It affected every part of her life.
"She's no longer her carefree, happy go-lucky self and finds that she is depressed.
"She feels she's serving a sentence because of what's happened to her."
In a joint statement, the victim and her family said: "We are thrilled that justice has been done and that he will finally have to pay for what he did - but the ordeal does not end here.
"We have not walked away from court today free of this nightmare and, though we are hopeful for the future, we are sure our lives will never be the same again."
Graham Buchanan, from the Crown Prosecution Service, said: "Zack Thompson's defence of sleepwalking to an allegation of rape has been successfully challenged through legal argument before a judge at the Crown Court.
"The prosecution team demonstrated to the court that neither non-insane automatism, by way of sleepwalking, nor temporary insanity could in this case form a defence.
"Prosecutors have worked long and hard to make this happen, including securing evidence from the scene from the Portuguese authorities and identifying and assessing necessary medical experts to show that a defence of sleepwalking was not valid in this case.
"As a result of the judge ruling in accordance with the prosecution's arguments, the defendant pleaded guilty without taking the case to trial."
In 2011, John Docherty, from Glasgow, was found guilty of attempted murder despite claiming he was sleepwalking at the time.