The order requires Repsol to submit a new spill management plan and obtain regulatory approval before reopening its marine terminals for receiving.
The decision means that the facility will have to shut down, taking with it about 40 percent of Peru's gasoline and diesel production.
"We have taken the measure of stopping all hydrocarbon loading and unloading activities in the Peruvian sea, on behalf of Repsol, until it offers technical guarantees that another spill will not occur," Peru's Ministry of the Environment said in a statement.
"Repsol, up to now, has not guaranteed with certainty that it is prepared to deal with a new hydrocarbon spill at the other three hydrocarbon loading and unloading buoys that it operates in our sea."
In a statement, Repsol called the order "disproportionate and unreasonable," but it said that it would cooperate with the authorities to resume production as soon as possible. It pledged to make "the greatest efforts to avoid the risk of shortages of essential products for Peruvian citizens and the country's development."
In the meantime, it says that it is making progress on the cleanup: at a cost of about $28 million, it has flown in 30 skimmers, 3,770 meters of containment barrier, 84,500 meters of sorbent material and 30 storage tanks, along with other equipment.
Locally, it has hired on about 2,000 beach cleanup staff and about 144 pieces of heavy machinery. A criminal inquiry into the origins of the spill is under way. On Friday, a Peruvian judge granted a local prosecutor's request to bar four of the refinery's top managers from leaving the country until after an investigation is completed.
The oil spill at La Pampilla occurred on January 15 while the Suezmax tanker Mare Doricum was unloading a shipment at an offshore mooring buoy. An estimated 12,000 barrels of oil entered the water, according to Peruvian officials.
The spill has coated miles of beaches near the nation's capital, as well as the shores of an environmentally-sensitive marine reserve and a seabird sanctuary.
So far, an estimated one-third of the crude oil has been recovered for disposal.
The tanker Mare Doricum has finished unloading her cargo, but she is still detained while the investigation into the circumstances of the spill continues.
Her operator asserts that the release of petroleum came from a pipeline leak, and that the vessel bears no responsibility.