In a video posted on his Twitter account, Johnson said: "I've developed mild symptoms of coronavirus, that is a temperature and a persistent cough, and on the advice of the chief medical officer I've taken a test. That has come out positive, so I am working from home, I'm self-isolating, and that's entirely the right thing to do.
"But be in no doubt that I can continue, thanks to the wizardry of modern technology, to communicate with all my top team, to lead the national fightback against coronavirus.
"And I want to thank everybody who's involved, I want to thank of course above all our amazing NHS staff," he said.
"We will get through it, and the way we're going to get through it is by applying the measures we've heard so much about.
"Thank you to everybody who's doing what I'm doing, working from home to stop the spread of the virus from household to household. That's the way we're going to win. We're going to beat it and we're going to beat it together."
Speaking to journalists on Friday morning, the prime minister's official spokesperson said that Johnson noticed he had mild symptoms on Thursday afternoon.
He was then tested in Number 10 and got the results around midnight that evening.
Johnson has been in self-isolation in the flat and he will remain there for seven days.
Buckingham Palace said in a statement that the Queen last saw the prime minister on March 11 and that she is "in good health".