Donald Trump branded the media "hostile" and called a reporter "a rude, terrible person" in a fiery news conference as he addressed the midterm election results.
In his first appearance since Americans went to the polls to deliver their verdict on his presidency, the US president was in a combative mood as he batted away suggestions that it had been a disappointing night for his administration.
He also claimed credit for the Republicans tightening their grip on the Senate.
Despite the Democrats gaining control of the House of Representatives for the first time since 2010, Mr Trump said voters had "clearly rebuked" the party.
He went on to both threaten to undermine and seek to work with the newly constituted House, which now has a make-up that could scupper several of his plans and even start impeachment proceedings.
Such a move will likely only happen if Robert Mueller finds strong evidence of criminality following his inquiry into alleged collusion between the 2016 Trump campaign and Russia – and the president said "two can play at that game" if his opponents sought to pursue any manner of investigation into him.
"They can play that game, but we can play it better," Mr Trump told reporters.
"All you're going to end up with is 'back and forth' – and two years will go by and we will not have done a thing."
With that in mind, Mr Trump suggested he was open to co-operation across party lines on issues such as lowering the price of prescription drugs, the regulation of social media firms, and – perhaps surprisingly – protecting the environment.
He said that there was "a very good chance" the Democrats and Republicans could work together, and that if they did they could "keep the American economic miracle going strong".
But he showed no sign of offering a similar olive branch to journalists in the room, his continued disdain for whom was typified by an electrifying exchange with CNN reporter Jim Acosta.
Responding angrily to questions over the Mueller investigation and an allegedly racist midterms campaign video he shared on Twitter, the president told him: "That's enough – put down the mic."
"CNN should be ashamed of itself having you working for them," he added.
"You are a rude, terrible person – and you shouldn't be working for CNN. The way you treat [White House press secretary] Sarah Huckabee [Sanders] and other people is horrible.
"When you report fake news, like CNN does a lot, you are the enemy of people."
"It's such a hostile media," he added. "It's so sad."
Mr Trump also accused a reporter of asking a "racist question" when she questioned if his campaign rhetoric ahead of the midterms had emboldened white nationalists.
In a statement, CNN said the president had "gone too far" during his clash with Mr Acosta – describing his "ongoing attacks on the press" as "dangerous and disturbingly un-American".
Mr Trump was far keener to talk about Republican gains in the Senate, boasting of the role he played in securing the extra seats and telling Sky News he came close to a "complete victory".
He mocked Republican candidates who had chosen not to "embrace" him during their campaign and subsequently lost, and said those who he had joined on-stage in the weeks leading up to the vote had "excelled".
"I think people like me and the job I'm doing," he said.
"I was very well received by the people of our great country. I focused on the Senate and we had tremendous success with the Senate."
The Republicans have gained two seats in the Senate, taking their total to 51, with the Democrats on 46 – which the president said represented "an incredible day".
But in the House of Representatives, the Republicans now sit on 196 seats compared to 220 for the Democrats – two more than the majority needed to take control.
Nancy Pelosi, the Democrat leader in the House, said the party "must stand our ground" in its efforts to hold the government to account, with both parties already looking ahead to the race to the White House in 2020.
Mr Trump used his news conference to confirm that US vice president Mike Pence would again be his running mate, but did not rule out other changes to his White House team in the coming weeks – and Attorney General Jeff Sessions resigned little more than an hour later.
Before then, the president confirmed that he would have "a much stronger opinion" to share over the killing of journalist Jamal Khashoggi.
He said he was working with Congress, Turkey and Saudi Arabia over the investigation into the death, which has seen the president come under pressure to loosen US ties with oil-rich Riyadh.
More from Donald Trump
And in other foreign policy news provided during what was a wide-ranging press conference, Mr Trump said he would have a second meeting with North Korean leader Kim Jong Un in early 2019.
"The sanctions are on, the rockets have stopped, the hostages are home – we're very happy with how it's going," he said.