The miners, ranging in age from 23 to 58, walked out without assistance about an hour after dawn from a reinforced tunnel that rescuers had built as they removed more than 26 feet (8 meters) of dirt and rock.
"On the second day, we were saying that they weren't going to get us out, that we were going to die in there," said Santiago Tapia, 21, the youngest of the miners. Tapia spoke with The Associated Press at the Social Security Hospital in Ica, where all the miners were taken to recover from dehydration.
"Inside, we prayed, we cried. We also cried with our relatives outside who were desperate," said Tapia, the father of a 2-year-old daughter.
Other moments were lighter. "We conversed, we told each other jokes, talked about our lives, things that had happened to us," Tapia said. "We also talked about politics, a bit of everything. We made ourselves laugh so we wouldn't feel bad inside there."
The miners wore sunglasses and were covered with blankets when they walked free. President Ollanta Humala was there to greet them after spending the night at the mine 150 miles (240 kilometers) southeast of the capital of Lima.
The miners were trapped by a cave-in triggered by an explosion they themselves had set.
They had communicated with rescuers through a hose, in place before the collapse, by which they also received food and medicine during their ordeal in a horizontal shaft dug into a mountainside.
It became their lifeline. "Thanks to that hose we are now still alive," Tapia said.
"It's pretty ugly inside," said fellow miner Edwin Bellido. "We slept on the ground on muddy plastic."
On the first day, miners grew desperate when one of their companions became ill, Bellido said.
But he said the miners kept their spirits up, including by singing and running in the 160-foot-long (50-meter) tunnel. They even danced "to pass the time," Bellido said.
The Cabeza de Negro mine that they were working had been abandoned in the 1980s.
Humala said the incident points up the dangers of working in such mines in Peru, labor in which tens of thousands are engaged. He said he had given instructions for Cabeza de Negro to be sealed definitively.
The rescue drew some comparisons to the 69-day ordeal of 33 Chilean miners trapped more than 2,000 feet (700 meters) underground in 2010 near the Chilean city of Copiapo.
The Peru rescue was not by any measure a comparable engineering feat because the miners were not similarly trapped deep beneath the earth. Neither heavy equipment nor drilling was required to extract them. Rescuers relied primarily on shovels, pick axes and wheelbarrows.
Alonso Navarro Cabanillas, president of the regional government in Peru, said that about 30,000 informal miners such as the ones who were trapped work in the Ica region.
Mining is the top economic activity in Peru, where 61 percent of all exports are associated with the sector. Peru is the world's No. 2 exporter of copper and the No. 6 exporter of gold.