The victory added to the list of battleground states that Mr. Trump lost in 2020 and flipped back four years later.