A former FBI boss has been named special counsel to oversee an inquiry into Russia's alleged meddling in the election and any Trump campaign ties.
In naming Robert Mueller, the deputy attorney general said it was in the public interest to have an outsider.
The appointment was widely endorsed by politicians from both sides.
In a tweet President Donald Trump described the situation as "the single greatest witch hunt of a politician in American history".
He also questioned why his election opponent Hillary Clinton and his predecessor President Barack Obama had not been investigated.
"With all of the illegal acts that took place in the Clinton campaign and the Obama Administration, there was never a special councel [sic] appointed," he wrote.
Calls for a special investigation had mounted since Mr Trump fired the most recent FBI director, James Comey, last week.
The announcement apparently took the White House by surprise, with Mr Trump only being informed of it after Deputy Attorney General Rod Rosenstein had signed the order.
The FBI and Congress are looking into potential links between Mr Trump's campaign team and Russia. Mr Mueller will take over the FBI investigation.
US intelligence agencies believe Moscow tried to tip the election in favour of Mr Trump.
Meanwhile the New York Times reports that Trump aide Michael Flynn had told his transition team in early January - earlier than was previously thought - that he was under investigation for working as a paid lobbyist for Turkey during the election campaign.
Mr Trump appointed Mr Flynn as his national security adviser weeks later despite the warning, but he was sacked after just 24 days.
In his statement announcing Mr Mueller's appointment, Mr Rosenstein said: "The public interest requires me to place this investigation under the authority of a person who exercises a degree of independence from the normal chain of command."
Mr Mueller, who will have wide-ranging powers, said simply: "I accept this responsibility and will discharge it to the best of my ability."
How the latest events unfolded:
- Monday 17:00 (22:00 GMT): Washington Post reports that Mr Trump disclosed classified intelligence to Russia
- Tuesday 13:30: New York Times reports that the intelligence came from Israel
- 17:15: New York Times reports on Comey memo stating Mr Trump asked him to end investigation into ex-national security adviser Mike Flynn
- Wednesday 18:00: Justice department announces appointment of special counsel, Deputy Attorney General Rod Rosenstein signs order
- 21:15: New York Times reports that Trump transition team knew of Flynn investigation before he became president
What was the reaction?
Just over an hour after the news of Mr Mueller's appointment emerged, President Trump predicted the new investigation would clear him and his team.
"A thorough investigation will confirm what we already know - there was no collusion between my campaign and any foreign entity," said the president.
The top Democrat in the Senate, Chuck Schumer, said Mr Mueller was "exactly the right kind of individual for this job". But House minority leader Nancy Pelosi was more cautious.
"A special prosecutor is the first step, but it cannot be the last," she said, calling for a "truly independent, outside commission".
For the Republicans, Senate Majority Leader Mitch McConnell said the appointment "confirms that the investigation... will continue".
House Speaker Paul Ryan said the appointment was consistent with the goal of ensuring "thorough and independent investigations are allowed to follow the facts wherever they may lead".
The stakes just rose: analysis by Anthony Zurcher, BBC News, Washington
In announcing the appointment of a special counsel, Mr Rosenstein cited the "unusual circumstances" of the ongoing FBI Russia investigation. That's an understatement.
The circumstances are not just unusual, they are unprecedented. The nation has never had an administration so embattled so early in its term. There have never been such grave allegations of electoral meddling by a foreign power in a US presidential election.
Then again there has never been a president quite like Donald Trump.
Now the Russia story enters a new, more serious phase. Robert Mueller has a sterling reputation in Washington, DC. He worked with Mr Comey when the latter served as deputy attorney general in George W Bush's administration. He understands pressure-cooker politics and knows how to navigate the corridors of power.
He has wide latitude to conduct his investigation and bring criminal charges, if necessary.
While Mr Mueller is technically still part of the justice department and ultimately reports to Mr Trump, his stature is such that he is unlikely to be cowed by the president.
Independent investigations often take on a life of their own and can reach unexpected conclusions. With Mr Mueller in the game, the stakes just went up.
What powers will Mr Mueller have?
Normally US prosecutors answer to the attorney general. However, for investigations into high-ranking officials in the executive branch the attorney general - or in this case Mr Rosenstein - can appoint a special counsel with greater independence from the executive.
But while special counsels are free from day-to-day supervision by the justice department, they must notify the attorney general of any "significant" action and they would need to ask permission to expand the investigation beyond their mandate.
Mr Mueller has the authority to investigate not only links or co-ordination between Russia and Trump campaign officials, but also "any matters that arose or may arise directly from the investigation".
The role should not be confused with that of independent counsel, a role introduced in legislation by Congress after the 1970s Watergate scandal.
Appointed by a three-judge panel, the independent counsel operated outside the jurisdiction of the justice department.
But after the experiences of the Iran-Contra investigation during the Reagan administration and the inquiry into President Bill Clinton's Whitewater land deal, the law fell out of favour with both Republicans and Democrats, and Congress failed to renew it in 1999.
What's the background to this?
The White House has been engulfed in crisis following Mr Comey's abrupt dismissal and allegations that Mr Trump asked the ousted FBI chief to drop an inquiry into links between his ex-national security adviser and Russia.
Mr Trump's national security adviser, Michael Flynn, was forced out in February after he misled the vice-president about his conversations with Russia's ambassador before Mr Trump took office.
The White House has denied it put pressure on Mr Comey but the revelations fuelled Democratic claims that Mr Trump had tried to conceal his team's connection to Russia.
Mr Mueller, 72, served as FBI director for 12 years under Presidents George W Bush and Barack Obama as the longest serving bureau chief since J Edgar Hoover.
He is expected to announce his resignation from a private law firm to avoid conflicts of interest.