Hollywood superstar Tom Hanks played Lovell in director Ron Howard's acclaimed 1995 film. It recounted NASA's Apollo 13 mission, which was planned as humankind's third lunar landing but went horribly wrong when an onboard explosion on the way to the moon put the lives of the three astronauts in grave danger.
Lovell and crew mates Jack Swigert and Fred Haise endured frigid, cramped conditions, dehydration and hunger for three-and-a-half days while concocting with Mission Control in Houston ingenious solutions to bring the crippled spacecraft safely back to Earth.
"A 'successful failure' describes exactly what (Apollo) 13 was - because it was a failure in its initial mission - nothing had really been accomplished," Lovell told Reuters in 2010 in an interview marking the 40th anniversary of the flight.
The outcome, the former Navy test pilot said, was "a great success in the ability of people to take an almost-certain catastrophe and turn it into a successful recovery".
The Apollo 13 mission came nine months after Neil Armstrong had become the first man to walk on the moon when he took "one giant leap for mankind" during the Apollo 11 mission on July 20, 1969.
There was drama even before Apollo 13's launch on April 11, 1970. Days earlier, the backup lunar module pilot inadvertently exposed the crew to German measles but Lovell and Haise were immune to it. Ken Mattingly, the command module pilot, had no immunity to measles and was replaced at the last minute by rookie astronaut Swigert.
The mission generally went smoothly for its first two days. But moments after the crew finished a TV broadcast showing how they lived in space, an exposed wire in a command module oxygen tank sparked an explosion that badly damaged the spacecraft 320,000 km from Earth. The accident not only ruined their chances of landing on the moon but imperiled their lives.
"Suddenly there's a 'hiss-bang. And the spacecraft rocks back and forth,'" Lovell said in a 1999 NASA oral history interview.
"The lights come on and jets fire. And I looked at Haise to see if he knew what caused it. He had no idea. Looked at Jack Swigert. He had no idea. And then, of course, things started to happen."
Swigert saw a warning light and told Mission Control: "Houston, we've had a problem here." In the movie, the line is instead attributed to Lovell and famously delivered by Hanks - slightly reworded - as: "Houston, we have a problem."
With a dangerous loss of power, the three astronauts abandoned the command module and went to the lunar module - designed for two men to land on the moon. They used it as a lifeboat for a harrowing three-and-a-half day return to Earth.
The astronauts and the US space agency experts in Houston scrambled to figure out how to get the crew safely home with a limited amount of equipment at their disposal.
People worldwide were captivated by the events unfolding in space - and got a happy ending. The astronauts altered course to fly a single time around the moon and back to Earth, splashing down in the Pacific Ocean near Samoa on April 17, 1970.
Lovell never got another chance to walk on the moon after Apollo 13, which was his fourth and final space trip.
Lovell, who later had a moon crater named in his honour, retired as an astronaut in 1973, working first for a harbour towing company and then in telecommunications.
He co-authored a 1994 book, Lost Moon: The Perilous Voyage of Apollo 13, that became the basis for Howard's film.
Lovell made a cameo appearance in the film as the commander of the US Navy ship that retrieves the astronauts and shakes hands with Hanks.
James Lovell was born in Cleveland on March 25, 1928. He was just five when his father died and his mother moved the family to Milwaukee. He became interested in space as a teenager. He graduated from the US Naval Academy in 1952 and became a test pilot before being selected as a NASA astronaut in 1962.
He had four children with his wife, Marilyn.