A few hours later on the same court, 10th-seeded American John Isner produced yet another marathon match, but this time lost, 18-16, in the fifth set.
Nadal also made it to the third round, defeating Denis Istomin of Uzbekistan, 6-2, 6-2, 6-0, and improving his record at Roland Garros to 47-1.
The second-seeded Spaniard has won the French Open six times, and one more will break the record he shares with Bjorn Borg.
Murray could barely walk straight when the first match of the day started, gingerly trotting around the red clay with the equivalent of a big target on his back. Nieminen took advantage, at the beginning.
But after losing the first four games, Murray called for a trainer. He then broke back to 4-1, and needed more treatment during the changeover. It was then that he started to consider retiring from the match.
"It was around that period, end of the first set, and then when I played a couple more games," Murray said. "Then I was thinking whether to keep playing or not.
"I'm happy I did."
Isner, who won the longest match in history two years ago at Wimbledon, lost to Paul-Henri Mathieu of France, 6-7 (2), 6-4, 6-4, 3-6, 18-16. The match lasted 5 hours, 41 minutes - the second-longest by time in French Open history. The record is 6:33.
The last set alone took 2:28.
Isner beat Nicolas Mahut, 70-68, in the fifth set at Wimbledon in 2010.
No. 5 Jo-Wilfried Tsonga of France and No. 6 David Ferrer of Spain also advanced, while Wimbledon champion Petra Kvitova reached the third round by beating Urszula Radwanska of Poland, 6-1, 6-3.
Kvitova won her first Grand Slam title at Wimbledon last year, and then won the WTA Championships. The fourth-seeded Czech, who has yet to win a title in 2012, was never really in trouble.
Defending champion Li Na easily advanced by beating Stephanie Foretz Gacon of France, 6-0, 6-2.
Caroline Wozniacki also made it through. The ninth-seeded Dane beat Jarmila Gajdosova of Australia, 6-1, 6-4.
Wozniacki is still looking for her first Grand Slam title. At Roland Garros, she has never been past the quarterfinals, losing at that stage in 2010.
Francesca Schiavone, the 2010 French Open champion and runner-up last year, defeated Tsvetana Pironkova of Bulgaria, 2-6, 6-3, 6-1.