LOS ANGELES — Galen Rupp and Amy Cragg won the steamy U.S. Olympic team marathon trials Saturday, earning berths to the Rio Games.

The 29-year-old Rupp completed his marathon debut through Los Angeles in 2 hours, 11 minutes, 10 seconds. Cragg, who was fourth in the trials four years ago, pulled away late to win in 2:28:27.

On the men’s side, 40-year-old Meb Keflezighi finished second about a minute later to become the oldest U.S. Olympic marathon runner. Jared Ward finished third. The top three finishers earned an Olympic spot.

Cragg finished ahead of Desiree Linden and Shalane Flanagan, who also made the Olympic team.

Rupp pulled away from Keflezighi over the last three miles.

Ethan Shaw of Falmouth was the top Maine finisher, taking 21st in the men’s race in a time of 2:20:56. Amanda Nurse Allen, a Waynflete and Bowdoin graduate, was the top female Maine finisher, coming in 63rd in 2:49:22.