It’s not often Michael Phelps enters a race as an underdog. It’s not often he looks threatened, or like he has something to prove, or appears to be showing a bit of competitive weakness. But such skepticism gradually crept in before the 200-meter freestyle final at the U.S. Olympic swimming team trials Wednesday night.

And all of it went away in fewer than two minutes — specifically, by the time Phelps out-lunged Ryan Lochte at the wall by just five hundredths of a second. With the narrow victory, Phelps reclaimed his preeminence in the event and made it clear he does not intend to head to the London Summer Games swimming weakly in Lochte’s shadow.

Phelps clocked 1 minute 45.70 seconds as Lochte came home in 1:45.75, ensuring that both men will compete in the event in London. Phelps’s victory came after a resounding defeat Monday to Lochte in the 400 individual medley final — and after posting slower times than Lochte in three preliminary round races.

“Just being able to get in the water and racing is something that motivates me,” said Phelps, who lost in the world championship finals of the event last year to Lochte. “Every time we get in the water, it’s coming down to a touch.”

Wednesday, as some 13,000 fans stood screaming and cheering as if for a touchdown sprint, Phelps and Lochte engaged in such an intense, focused, mano-a-mano duel that they forgot, as Phelps’s Coach Bob Bowman put it later, to swim fast. Lochte took a relaxed approach at the start, so Phelps was content to power into the lead and stay just in front. The two once raced side by side, both waiting until the final length to take off.

“When we’re next to each other, we kind of play cat and mouse,” Phelps said. “We don’t sort of jump out after it. . . . We just put every ounce of effort into the last 50.”

Both said they needed to go out with more urgency in London.

“It was really easy,” Lochte said. “I thought I was going out for the mile. I was just not trying, and then the last 75 it was just like, ‘All right, I’ve got to put it in gear’ — and by that time it was a little too late.”

After the race, as Phelps rushed to the practice pool to prepare for the semifinals of the 200 butterfly later in the evening — he easily qualified for Thursday’s final — teen star Missy Franklin, 17, did what had been expected since she started drawing attention as an overachieving 14-year-old: She clinched a spot on this summer’s U.S. Olympic team.

Franklin roared back from fourth place in the second half of the 100 backstroke final, winning the event in an American-record time of 58.85 seconds as Rachel Bootsma took second in 59.49. Franklin then displayed her usual mix of pure joy and irrepressible excitement.

“I have dreamed about this moment, and I never thought it would come true as a 17-year-old,” she said. “But dreams really come true. Honestly, right now, I’m the happiest girl in America.”

Eleven-time Olympic medal winner Natalie Coughlin finished third in 1:00.06, putting her in jeopardy of failing to qualify for her third Olympic team. Coughlin has just one more shot, in the 100 freestyle.

“Tonight, I gave it my best,” she said. “That’s all you can ask for. . . . It’s not exactly what I was hoping for coming into this. . . . I’m a little bummed, but not nearly as much as everyone is expecting me to be. Walking around the pool deck, people are acting like you’re dying or something.”

Just 20 minutes before the 100 back final, Franklin competed in the semifinals of the 200 freestyle, finishing fifth overall in 1:58.04 as Allison Schmitt, the 400 champion, ran away with the top time (1:55.59). Bethesda’s Katie Ledecky, 15, missed advancing to Thursday’s final by just .02 of a second, posting the ninth-best time (1:58.66).

Franklin said she considered dropping out of the 200 free but wanted to put herself in position to win a spot on the 4x200 relay team. Despite the difficult double, she said, she wasn’t worried when she found herself well behind the leaders at the turn of the 100 back.

“The last 50 is like my specialty,” she said. “I love coming home, seeing the [Olympic] rings on the bottom of the Jumbotron and pushing myself as hard as I can.”

Phelps surely felt the same Wednesday night, finally. He had lost three straight major finals to Lochte, dating from the 2011 world championships in Shanghai.

“We want to be first,” said Lochte’s coach, Gregg Troy. “[When] two of the best ever go head-to-head, they’re both in the prime, one guy is going to win, and one is going to lose. . . . You can’t get comfortable and overconfident at this level.”

In other news, Matt Grevers won the men’s 100 backstroke in 52.08, and Breeja Larson won the women’s 100 breaststroke, finishing in 1:05.92 and topping Rebecca Soni (1:05.99) and Jessica Hardy (1:06.53).