A Chilean miner ran, walked and hobbled his way to the finish line of the New York City Marathon on Sunday, showing the passionate grit that helped him survive more than two months trapped underground.

Edison Pena crossed the Central Park finish line at 3:24 p.m., with a time of 5 hours, 40 minutes, 51 seconds. The Elvis fan was draped in a Chilean flag as Presley songs played over the speakers.

The 34-year-old survivor had beat his own goal — to complete the course through the city's five boroughs in six hours.

Bags of ice covered his swollen knees as a grim-faced Pena walked the second half of the marathon, but he summoned enough energy to run the last stretch along Central Park West.

"In this marathon I struggled," he said. "I struggled with myself, I struggled with my own pain, but I made it to the finish line. I want to motivate other people to also find the courage and strength to transcend their own pain."

Pena's personal victory came just weeks after he was still training in near-darkness, jogging 6 or 7 miles each day 2,300 feet underground in stifling heat and humidity. He and 32 other men survived 69 days in the caved-in mine before they were rescued last month.

He said running was his salvation — his way of proving how much he wanted to live.

On this sunny day in Manhattan, the strong will that kept him focused came shining through.

It didn't seem to matter to the world whether No. 7127 actually finished the race running into Central Park — or ended his first marathon barely making it.

To the wildly cheering crowds, he was a winner among the 45,000 runners, including some of the world's best marathoners.

At a news conference, Pena was asked to compare his hours in the New York race with the days in the mine.

"In the mine, I ran alone," he said.

He called the marathon "an incredible dream" — because of "how warm and welcoming and supportive the Americans are here," with signs along the route reading "Go, Edison!" and "Go for it!" Others raised their palms in high-fives that met his hand.

Pena said he also was "motivated" by Chileans shouting and waving his country's flag.

His persistence in the face of terrifying odds had made him a global folk hero on his first-ever trip outside Chile, and he entertained America for days with banter and singing Elvis songs.

On Sunday, he turned serious — a man on a mission.

Pena started off running in Staten Island at 9:40 a.m.

The trouble started about an hour into the marathon, when a grimace crossed his face as he slowed a bit, apparently already in pain. Cheered on by spectators and surrounded by supporters keeping pace, he kept running, his knee bound in black.

Shortly after noon, "The Runner" — as his fellow miners had nicknamed him — left Brooklyn and made his way into Queens, reaching the 14-mile mark of the race.