Mohammed Badshah Ansari was handed the sentence after a trial heard how the 28-year-old broke into the flat through a window in November last year and then raped the victim twice while threatening her with a knife.
The victim — who had travelled to India to learn classical music — left for Germany after the attack but testified about her ordeal via video link.
She cannot be named for legal reasons.
"The court has to keep in mind the interest of the society at large and the case does not have any ground for leniency," Judge Shalini Phansalkar Joshi said as he announced the sentence in Mumbai.
Ansari, who has a long criminal record, was found guilty earlier this month of rape, robbery, criminal intimidation and trespass after his trial in the Mumbai sessions court.
He had pleaded for leniency as he has a family who is dependent on him.
The sentencing comes as India prepares to mark the first anniversary of the death of a 23-year-old physiotherapy student who had been gang-raped on a moving bus in the capital New Delhi.
The attack on the bus triggered massive protests over the levels of violence against women in a country where there have been several high-profile sex attacks against foreigners in recent months.
A judge last week sentenced three Nepalese men to 20 years in jail for the gang-rape of a US tourist in June in the northern state of Himachal Pradesh.
Six men were sentenced to life in prison in July for the gang-rape and robbery of a 39-year-old Swiss woman cyclist holidaying in the central state of Madhya Pradesh four months earlier.