Judge Thokozile Masipa also gave Pistorius a three-year suspended sentence for a firearms charge.
The parents of Reeva Steenkamp told the BBC they were happy with the sentence and relieved the case was over. The defence said it expected Pistorius to serve about 10 months in prison.
Pistorius was convicted of culpable homicide but cleared of murder.
Prosecutors had called for a minimum 10-year term, and the defence had argued for community service and house arrest.
Pistorius showed little reaction to the sentence other than to wipe his eyes before being led away to the cells downstairs.
He was then driven away from court in a police van to Pretoria’s Kgosi Mampuru prison.