Democrats have won both chambers of the US Congress in the midterm elections, defeating Donald Trump’s Republicans with Senate victories that reached into longstanding Republican strongholds.

The party’s gains included Texas, Ohio and Kansas, which last elected a Democrat to the Senate almost 100 years ago. Together with victory in the House of Representatives, the results give Democrats control of Congress for the remainder of Trump’s presidency.

Trump said the Democrats “did a good job” and acknowledged that the Iran war and higher fuel prices had contributed to the Republican defeat. His response placed both the conflict and pressure on household budgets among the reasons for his party’s losses.

The breadth of the Senate gains shows that the Republican setback extended beyond closely contested territory. Kansas provides the clearest historical measure: a state that had not elected a Democratic senator for nearly a century has now helped deliver the party’s congressional majority.

Cost-of-living anger offers an explanation for the defeat, although the results alone do not establish how much weight voters gave each issue. Trump’s acknowledgement of higher fuel prices nevertheless recognises their political cost.

In Michigan, Democrat Abdul El-Sayed claimed victory. He would become the first Muslim to serve in the US Senate.