Representative Elissa Slotkin, a Democrat, and former Representative Mike Rogers, a Republican, will square off for an open Senate seat in Michigan in what is likely to be one of the tightest and most closely watched Senate campaigns in the country.

As expected, Ms. Slotkin and Mr. Rogers easily prevailed in their Senate primaries on Tuesday, according to The Associated Press, setting up a remarkably even contest for the fall.

Both held the same Central Michigan House district around Lansing and East Lansing. Both made their names in national security, Mr. Rogers as chairman of the House Intelligence Committee, Ms. Slotkin with her work for the Central Intelligence Agency, Defense Department, State Department and White House National Security Council.

And in vying for the seat of Senator Debbie Stabenow, a Democratic stalwart who is retiring, both still need to work to broaden their appeal in a pivotal battleground where neither has held statewide office.

Forecasters such as the nonpartisan Cook Political Report initially favored Democrats to hold the seat, but President Biden’s struggles in Michigan — fueled in part by Israel’s war in Gaza — shifted the Senate contest to a pure tossup.

The most recent polling gives Ms. Slotkin a slight edge, consistent with other swing states where Democratic candidates have run ahead of their presidential nominee. But Michigan holds a specific challenge to Ms. Slotkin. She has made her name and reputation as a defense-minded Democrat both in the executive branch of government and in Congress. She is also Jewish and pro-Israel.