The government said it closed the site, and the Inca trail hike leading up to it, to protect tourists and citizens.
Hundreds of people who were stuck for hours at the foot of the 15th Century Inca Citadel have now been rescued.
The violent protests, which have seen dozens of people killed, began when Peru's previous leader was ousted.
Rail services to Machu Picchu were suspended on Thursday after some train tracks were damaged, allegedly by protesters.
It left 418 people stranded at the site, tourism minister Luis Fernando Helguero said at a news conference on Saturday.
However by Saturday night, the tourism ministry announced that everyone - 148 foreigners and 270 Peruvians - had been safely evacuated on trains and buses.
Sitting high on a mountain in the Andes, Machu Picchu is considered one of the new seven wonders of the world. It is hugely popular with tourists, with around a million people visiting every year.
In a statement, Peru's culture ministry said that those who had already bought tickets for the site would be able to use them for one month after the end of the demonstrations, or get a refund.
Demonstrators in Peru are demanding fresh elections and calling for the new President, Dina Boluarte, to stand down, which she has so far refused to do.
Source: BBC News