Katie Ledecky sees her new world-record time of 3 minutes 58.37 second in the 400-meter freestyle. (Chris Hyde/Getty Images)

It’s hard to imagine Michael Phelps, swimming’s biggest star and the most decorated Olympian of all time, being overshadowed on the day he returned to the top of the medal podium. But Katie Ledecky made a convincing case Saturday at the Pan Pacific Championships in Gold Coast, Australia.

Ledecky, the two-time All-Met Swimmer of the Year from Bethesda, set a world record in winning the women’s 400-meter freestyle with a time of 3 minutes 58.37 seconds, shaving nearly a half-second off the mark she set earlier this month at the U.S. national championships. The victory gave Ledecky, 17, her fourth gold medal of the event and marked the sixth time she set a world record since the start of last summer’s world championships.

Earlier on the cold, damp night at Gold Coast Aquatic Centre, Phelps signaled to the world that, four months after ending his retirement from the sport, he isn’t quite done. He won his first individual gold medal since the 2012 London Olympics with a come-from-behind victory in the men’s 100 butterfly.

Phelps won in 51.29 seconds, surging in the final 50 meters to beat out U.S. teammate Ryan Lochte, who finished second in 51.67. It wasn’t as fast as Phelps’s world-best 51.17 from preliminaries at U.S. nationals, but it’s an encouraging result for the event’s world record holder after he failed to win gold two weeks ago at nationals in Irvine, Calif.

“It definitely feels good to have that sort of confidence back to be able to do it in an individual event,” Phelps told reporters. “What it does is really just guarantee me a spot on the world championships team next summer — that’s the biggest thing and most important thing.”

Michael Phelps rallied past Ryan Lochte in the 100 butterfly for his first individual gold medal since the London Olympics. (Dave Hunt/European PressPhoto Agency)

Then Phelps’s attention was turned to Ledecky.

“She’s a stud,” he said when asked by a reporter whether Ledecky reminded him of himself at 17. “Watching her swim, it’s remarkable. What is that, her third or fourth world record in the last three or four months?”

Said Ledecky, who already held the world freestyle records in the 400, 800 and 1,500 entering the meet: “It’s a great feeling. It never really gets old. I have some long-term goals. We’re not quite there yet, but we’ll get there.”

Ledecky was under world record pace for much of Saturday’s race but fell off just before the final turn. Like she did two weeks ago at nationals, she surged in the final length and touched for a new world record — the first at the newly constructed outdoor pool.

“I didn’t even think about that. That is pretty neat,” Ledecky said, joking with reporters about taking advantage of the rain that had calmed from a torrential downpour to a drizzle. “It was beautiful out there tonight. . . . There’s no rain underwater, so it doesn’t really bother me.”

Cierra Runge, 18, of Cochranville, Pa., touched six seconds later to earn silver.

Tyler Clary, the 25-year-old all-around swimmer who has spent his career in the shadow of Phelps and Lochte, won the men’s 200 backstroke over Japan’s Ryosuke Irie, 1:54.91 to 1:55.14. Clary was the surprise Olympic champion, beating Irie and Lochte for gold in London.

It was the third gold of the night for the United States and its 11th overall to lead the medal count. Australia trailed with eight gold medals after a gilded night that included victories in the women’s 100 butterfly and 200 backstroke and double relay gold in the men’s and women’s 4x100 relays.

Australia’s sprint duo of James Magnussen and Cameron McEvoy, 20, powered their relay to gold ahead of the United States. It gave Phelps his first silver of the meet and his third medal overall.

“I know there’s a lot that can happen in a year with training, and that’s what I’m looking forward to,” Phelps said. “This is a building year for me after just getting back in the water and going through the ups and downs.”