Confirming his result via Twitter, the president said he and First Lady Melania Trump will be quarantining "immediately".
Mr Trump's positive test comes just hours after the White House announced senior aide Hope Hicks came down with the virus after traveling with the president several times this week.
Mr Trump was last seen by reporters returning to the White House today and looked to be in good health.
Mr Trump is 74 years old, putting him at higher risk of serious complications from a virus that has now killed more than 200,000 people nationwide.
Mr Trump announced today he and Ms Trump were beginning a "quarantine process" after Ms Hicks came down with the virus, though it wasn't clear what that entailed.
Mr Trump's physician, Sean P. Conley, has released a statement via the White House.
"I release the following information with the permission of President Donald J. Trump and First Lady Melania Trump," Dr Conley wrote.
"This evening I received confirmation that both President Trump and First Lady Melania Trump have tested positive for the SARS-CoV-2 virus.
"The President and First Lady are both well at this time, and they plan to remain at home within the White House during their convalescence.
"The White House medical team and I will maintain a vigilant watch, and I appreciate the support provided by some of our country's greatest medical professionals and institutions.
"Rest assured I expect the President to continue carrying out his duties without disruption while recovering, and I will keep you updated on any future developments."
It can take days for an infection to be detectable by a test.
The diagnosis marks a major blow for a president who has been trying desperately to convince the American public that the worst of the pandemic is behind them even as cases continue to rise with less than four months before Election Day.
And it stands as the most serious known public health scare encountered by any sitting American president in recent history.
Large crowds gather outside White House
Symptoms of COVID-19 can include fever, cough and breathing trouble. Most people develop only mild symptoms.
But some people, usually those with other medical complications, develop more severe symptoms, including pneumonia, which can be fatal.
In an interview with Fox News host Sean Hannity today, Mr Trump said he was awaiting results of a COVID-19 test.
"Whether we quarantine or whether we have it, I don't know," he said, adding Ms Trump was also awaiting results.
Ms Hicks traveled with the president multiple times this week, including aboard Marine One, the presidential helicopter, and on Air Force One to a rally in Minnesota on Wednesday, and aboard Air Force One to Tuesday night's first presidential debate in Cleveland.
Mr Trump had consistently played down concerns about being personally vulnerable to contracting COVID-19, even after White House staff and allies were exposed and sickened.
"I felt no vulnerability whatsoever," he said told reporters back in May.
He has instead encouraged governors to reopen their states and tried to focus the nation's attention on efforts to revive the economy ！ not a growing death toll ！ as he seeks another four-year term.
The news was sure to rattle an already shaken nation still grappling with how to safely reopen while avoiding further spikes.
The White House has access to near-unlimited resources, including a constant supply of quick-result tests, and still failed to keep the president safe, raising questions about how the rest of the country will be able to protect its workers, students and the public as businesses and schools reopen.
Senior staff have been tested for COVID-19 daily since two people who work at the White House complex tested positive in early May, prompting the White House to step up precautions.
Everyone who comes into contact with the president also receives a quick-result test.
Yet since the early days of the pandemic, experts have questioned the health and safety protocols at the White House and asked why more wasn't being done to protect the commander in chief.
Mr Trump continued to shake hands with visitors long after public health officials were warning against it and he initially resisted being tested.
He has been reluctant to practice his own administration's social distancing guidelines for fear of looking weak, including refusing under almost all circumstances to wear a mask in public.
Mr Trump is not the only major world leader known to have contracted the virus.
British Prime Minister Boris Johnson spent a week in the hospital, including three nights in intensive care, where he was given oxygen and watched around the clock by medical workers.
German Chancellor Angela Merkel self-isolated after a doctor who gave her a vaccination tested positive for the virus, and Canadian Prime Minister Justin Trudeau worked from home after his wife fell ill.
The White House got its first COVID-19 scare in early March when at least three people who later tested positive came in close proximity to the president at his private Florida club.
That included members of the Brazilian president's delegation, including the Brazilian charg└ d'affaires, who sat at Mr Trump's dinner table.
In mid-March, as the virus continued to spread across the country, the White House began taking the temperature of everyone entering the White House complex, and in April, it began administering rapid COVID-19 tests to all those in close proximity to the president, with staffers being tested about once a week.
The frequent tests gave some staff the false impression the complex was safe from the virus, and few, as a result, followed recommended safety protocols, including wearing masks.
But then the bubble broke.
On May 7, the White House announced that a member of the military serving as one of the president's personal valets tested positive for the virus, followed a day later by a positive diagnosis for Vice President Mike Pence's press secretary.
Even then, Mr Trump said he was "not worried" about the virus spreading in the White House.
But officials again stepped up safety protocols for the complex, directing everyone entering the West Wing to wear a mask.
"I think it's very well contained, actually," Mr Trump told reporters on May 11.
But by June, concerns at the White House had dissipated once again, with few staffers bothering with masks even as more and more people tested positive for the virus, including campaign staffers preparing for a Tulsa rally and Secret Service agents.
On July 3, Kimberly Guilfoyle, who is dating Mr Trump's eldest son, Donald Trump Jr, tested positive in South Dakota before an Independence Day fireworks show at Mount Rushmore.
Ms Guilfoyle, a former Fox News personality who works for Mr Trump's campaign, had not flown on Air Force One and had not been in direct contact with the president, though she had had contact with numerous top GOP officials.
In July, Mr Trump's national security adviser, Robert O'Brien, tested positive.
While there is currently no evidence that Mr Trump is seriously ill, the positive test also raises questions about what would happen if he were to become incapacitated due to illness.
The Constitution's 25th Amendment spells out the procedures under which a president can declare themselves "unable to discharge the powers and duties" of the presidency.
If he were to make that call, Mr Trump would transmit a written note to the Senate president pro tempore, Republican Senator Chuck Grassley of Iowa, and Democratic House Speaker Nancy Pelosi.
Mr Pence would serve as acting president until Mr Trump transmitted "a written declaration to the contrary".
The vice president and a majority of either the Cabinet or another body established by law, can also declare the president unable to discharge the powers and duties of his office, in which case Mr Pence would "immediately assume the powers and duties of the office as Acting President" until Mr Trump could provide a written declaration to the contrary.