Bremerton's Nathan Adrian had a race on his hands with Brazil's Bruno Fratus matching him stroke for stroke, but the Olympic champion wasn't about to let the race slip away.

Adrian touched the wall in 47.25 seconds to anchor Team USA to a gold medal in the 4x100 freestyle relay in a final time of 3 minutes, 10.06 seconds on the first day of the World Swimming Championships in Budapest, Hungary.

Brazil finished in 3:10.34 and Hungary, the host nation, earned its first-ever medal in the relay in 3:11.99. Both the Australians and Italians were disqualified for false starts.

Caeleb Dressel led off the race, putting the Americans out front with an American record time of 47.26. Townley Haas and Blake Pieroni followed as the Brazilians made their push before Adrian took off on the anchor.

Adrian kept the lead throughout, with Fratus pushing from the lane to his left shoulder, but the 2006 Bremerton High graduate out-touched his counterpart at the wall to give the U.S. the win by .28 seconds.

"We're really good at competing," Adrian said in a post-race online interview. "I think that's all we needed to do. It was pretty close, but with these guys there's no doubt in my mind we should be number one."

At the worlds two years ago, the Americans stunningly failed to qualify for the final in Kazan, a huge embarrassment for the swimming superpower.

Now, they're back on top of the world.

"There's a legacy that was left for us to take over," said the 28-year-old Adrian, the senior member of a squad that also included Townley Haas and Blake Pieroni. "I know when I leave, it will be in good hands."

The next race for Adrian will be the 100-meter freestyle on Wednesday.

For the women, Katie Ledecky continued her dominance on the international stage.

The 20-year-old American star began an audacious week by winning a pair of gold medals Sunday on the opening night of swimming along the Danube River. She cruised to a dominating victory in the 400-meter freestyle and put the U.S. ahead to stay in the 4x100 free relay.

"It was a good first night for Team USA," Ledecky said. "I'm happy with my two swims and how it all went."

The only blip of a disappointment: Ledecky didn't break the 400 free world record she set last summer at Rio de Janeiro. That merely demonstrates what a high standard she's set.

For the most part, her only competitor is the clock.

"It's my second-best time," Ledecky said. "There's no disappointment. It's a world championship gold medal and there's nothing to complain about there."

Ledecky touched in 3 minutes, 58.34 seconds — more than 3 seconds ahead of U.S. teammate Leah Smith but nearly 2 seconds off the world record (3:56.46) from the Olympics. China's Li Bingjie claimed the bronze.

About an hour later, Ledecky returned to the pool for the relay, a down-and-back sprint that is the weakest of her distances, but one that provides an opportunity to equal Missy Franklin's female record of six gold medals at the 2013 worlds.

Ledecky turned in the slowest split on the American team, actually slipping to third on her 50 flip. But she powered back to the front by the time she passed off to Olympic champion Simone Manuel, who closed it out for the Americans.

Sarah Sjostrom set a blistering opening pace for Sweden, taking down the first swimming world record of the championships with a split of 51.71. She eclipsed the 100 free mark of 52.06 set last year by Australia's Cate Campbell.

But Sweden didn't have enough speed on the back end and faded to fifth. Manuel touched in 3:31.72, anchoring a team that also included rising star Mallory Comerford and Kelsi Worrell.

Paul Newberry of the Associated Press contributed to this report.