Megan Rapinoe was a winner in her farewell game for the United States on Sunday, setting up a goal with a corner kick in a 2-0 triumph over South Africa.

The iconic 38-year-old striker, celebrated for off-field activism as well as glories on the pitch, ended her epic US career with 63 goals in 203 caps over more than 17 years with a 54th-minute exit at Chicago's Soldier Field.

"Just so grateful to play this long with so many amazing players and be able to be as successful as we've been on and off the field," Rapinoe said Sunday.

"I feel like when you come into something you want to leave it better than where you found it and I think I've done that."

Rapinoe sparked the Americans to crowns at the 2015 and 2019 Women's World Cups and gold at the 2012 London Olympics, but was a champion for social causes as well.

A vocal advocate for LGBTQ rights who has supported an array of US social justice issues, Rapinoe was presented the Presidential Medal of Freedom, America's top civilian award, in 2002 by President Joe Biden.

Rapinoe, FIFA's 2019 Women's Player of the Year, also was among the leaders of the US women's successful fight with US Soccer for equal pay and conditions with the men's squad.

"She has affected so many people's lives in a positive way. She has changed this sport forever," US forward Trinity Rodman said of Rapinoe.

"I'm so grateful I'm able to play on the same field with her as well as learn from her so she's a legend."

Rodman scored on a right-footed volley in the 18th minute off an assist from Alex Morgan for the Americans, who also beat South Africa 3-0 Thursday at Cincinnati.

Rapinoe, the 14th player to make 200 career appearances for the US women, made her magic four minutes into the second half.

US midfielder Emily Sonnett scored on a header in the 49th minute off a deflection of a Rapinoe corner kick, nodding the ball over a defender and just under the crossbar for a 2-0 US lead.

Players gathered to celebrate around Rapinoe, who struck a pose after encouragement from teammates.

Rapinoe was replaced by Margaret Purce in the 54th minute and departed to a standing ovation, teammates coming over to share a hug before she stepped off the pitch for the last time in a USA uniform.

"Trailblazer. Icon. Inspiration," the US women's team posted on social media after Rapinoe's exit. "You've made this sport, this country and this world a better place. Thank you."

Morgan, in a video tribute, told Rapinoe, "Your legacy is so much bigger than what you did on the field. You've just really impacted this team.

"You've made the most of your career because you've literally done it all. I'm just so proud of how you get to go out on your own terms."

I feel so at peace

Rapinoe said on the eve of her final match that she was most happy "by a mile" about her off-field success more than on-field accomplishments.

"What we've done off of the field, I think, has made such a lasting impact," Rapinoe said.

"I think we've been a big part of pushing, talking about whether it's gay rights or racial justice or trans rights, more into every conversation around sports, in particular around women's sports.

"We've been such a driver of that and have made that just as important as what we're doing on the field. I think we really believe it's just as important."That has helped Rapinoe feel at peace with the decision to end her career after a few final matches with her club side, OL Reign of the National Women's Soccer League.

"I feel like I got the most out of my career," Rapinoe said. "I did my absolute best and maximized my talent... I think that's probably why I feel so at peace.

"I've done everything the way I wanted to and feel like I really got the most out of this career that I possibly could have gotten."