STUTTGART, Germany — Simone Biles won a record 21st medal at the world gymnastics championships on Tuesday as the United States women retained their team all-around title.

It was the 15th world championship gold of Biles’s career, and it broke a tie with the Russian gymnast Svetlana Khorkina for the most medals over all by a woman at the world championships. She is now two short of Vitaly Scherbo’s 23, which is the record for both men and women.

“Every year it feels better and better just because we’re adding to the legacy,” Biles said. “I feel like I never think of records. I just go out there and do what I came to do, which is compete for the country.”