The press team, the Bad News Babes, wore pink jerseys. Congress wore navy blue ones. Organizers blasted an upbeat playlist: Shania Twain’s girl-power hit “Man! I Feel Like a Woman” had already played twice before the first pitch was thrown.

On Wednesday night, reporters and lawmakers traded hardball questions for literal softballs at the 10th annual Congressional Women’s softball game between members of the press and members of Congress.

With some 300 sign-toting fans in attendance, 19 players from the press and 14 representatives and senators from both parties took the field at Watkins Recreation Center, a diamond just behind a local elementary school in Capitol Hill.

Nancy Pelosi, the House minority leader, and House Speaker Paul Ryan even made brief appearances, greeting members of both teams for photos.

The announcers, Dana Bash, CNN’s chief political correspondent, and Senator Amy Klobuchar, Democrat of Minnesota, provided a stream of off-beat chatter and supplied the audience with morsels from the players’ bios. (“She has 15 chickens in Albuquerque and once filmed an entire advertisement on roller skates!”)

Representative Debbie Wasserman Schultz, Democrat of Florida, founded the event a decade ago, after she was found to have breast cancer, and the matchup serves as a fund-raiser for the Youth Survival Coalition, an organization supporting young women with breast cancer. It has since raised more than $1.4 million, according to organizers.

A week earlier, Republican and Democratic members of Congress played against each other at the congressional baseball game. But on Wednesday, members of Congress reached across the aisle to take on a common adversary: the press.

“It’s the proper role,” said Carl Hulse, The Times’ chief Washington correspondent and a coach for the press team.

The Glamorous Grandmas of Instagram

Media attention on the women’s game increased after a shooter opened fire at the Republicans’ congressional baseball practice last year. That shadow lingered on Wednesday night as police officers in bulletproof vests stood guard by the dugouts.

It’s a day that Times reporters and their colleagues remember: The women’s team was practicing for last year’s game when they learned that shots had been fired in Arlington.

“A lot of us had to cover that breaking-news moment; it meant some players went directly from our practice over to the scene of the shooting,” said Mikayla Bouchard, a senior staff editor at The Times’s Washington bureau, who served as a captain emeritus at Wednesday’s game. “Some of the players still had their softball shorts and shoes on and had to get blouses because they were doing live shots for their networks.”

On Wednesday, those memories were further away in the minds of the players and spectators at Watkins Recreation Center.

The game was a way to escape from the daily whirlwind of news at the Capitol. But for members of Congress, it’s an opportunity to forge relationships with both colleagues on the other side of the aisle, as well as the press that holds them accountable.

“We love it — you’ll pick up on our attempts to trash talk, but we have a great relationship with all of these ladies,” said Representative Martha Roby, Republican of Alabama. “There’s a lot of us who’ve been doing this for many years now and we’ve formed even relationships with them off the field as well.”

And for members of the press, the event presents the unusual opportunity to feel the media spotlight cast on them.

“It feels weird to be interviewed and photographed and have attention be on me because usually you’re on the other side,” said Alicia Parlapiano, a graphics editor at The New York Times. “The members are much more used to all of the craziness and the fans and the camera people.”

Still, the game was not without drama.

In the fifth inning, with the press leading 2-0, Bridget Bowman of the Capitol Hill news outlet Roll Call cracked a home run that flew past the fences, a first in the game’s history. That helped to cement the press’s 5-0 victory — the third straight win for the press team.

Minutes later the sky opened up, showering the field and ending the game early.

The winning team is already looking ahead to next year’s game.

They know the field of possible female softball players on the Hill is expected to grow, as a record number of women have stepped up and run for House and Senate races across the nation, in a 67 percent jump from 2016.

“It’s getting bigger every year,” said Mr. Hulse, the Washington correspondent. “We think next year Congress will be able to field a really good team. We’re actually kind of concerned about that.”