Melissa Reid, 20, from Lenzie, East Dunbartonshire, and Michaella McCollum, from Dungannon, Northern Ireland, pleaded guilty to the £1.5m smuggling charge at an earlier hearing.
The pair, both 20, faced the prospect of a maximum 15-year prison term but struck a behind-closed-doors plea bargain to secure a shorter sentence.
The pair were sentenced by Judge Pedro Miguel Puente Bardales today in what was described as a "brief process".
Judicial spokesman Daniel Vega said: "The women were very calm as the sentence was handed down at the court in the Sarita Colonia prison.
"They will now begin serving their sentence in the Santa Monica prison.
"It is still not clear whether they will be able to serve part of their sentence in the UK - the judge said that was not a decision for the court and they would have to reach an agreement with the prosecution."
Both women, who had been working on the Spanish party island of Ibiza this summer, had previously claimed they were coerced into carrying the drugs by Colombian drug lords who kidnapped them at gunpoint.
They said they were forced to board a flight from Lima to Spain with 24lb of cocaine in food packets hidden inside their luggage when they were arrested.
So far they have been held at the notorious Virgen de Fatima prison in Lima.
Their guilty pleas at the end of September came on the same day that the UN declared that Peru has now overtaken Colombia as the world's number one coca leaf producer, the raw material of cocaine.
According to a report by the United Nations Office on Drugs and Crime, coca plantations in Peru covered 60,400 hectares last year.
Peru's national prisons institute says that 90% of the 1,648 foreigners in the country's prisons are either sentenced or awaiting trial for drug trafficking.