He took the test, his fourth, on Monday after developing symptoms, including a high temperature, BBC reported.
Mr Bolsonaro has repeatedly played down the risks posed by the virus, calling it “a little flu” and saying that he would not be seriously affected by it.
He has also urged regional governors to ease lockdowns, which he says hurt the economy, and on Monday he watered down regulations on wearing face masks.
Mr Bolsonaro made the announcement in a TV interview on Tuesday. He said the fever he had been experiencing had gone down and that he felt “very well”.
The president said that he had started experiencing symptoms on Sunday. He said he had had a high temperature, a cough and had felt unwell.
He added that on Monday he had felt worse which prompted him to take the coronavirus test.
Mr Bolsonaro is in a higher-risk group because of his age, 65.
He said he was taking hydroxychloroquine – championed by US President Donald Trump – and azithromycin to treat the illness.
The executive director of the World Health Organization, Dr Mike Ryan, wished President Bolsonaro “a speedy and full recovery from this disease”, adding: “I think the message to us all is: we are vulnerable to this virus.”
‘I wouldn’t feel anything’
Back in April, Mr Bolsonaro said that even if he were to be infected with the virus, he would “not have to worry as I wouldn’t feel anything, at most it would be like a little flu or a little cold”.
When he made the remark, the number of Covid-19-related deaths was still under 3,000 and the number of infections was around 40,000.
Media captionFrom 21 April 2020: The BBC’s South America correspondent Katy Watson looks at how Bolsonaro has responded to the virus in Brazil
But the numbers have skyrocketed since then. As of Monday, the number of deaths was more than 65,000 and infections were over 1.6m, second only to the United States.
Despite the rising numbers, President Bolsonaro has argued that regional lockdowns are having a more damaging effect than the virus itself, and accused the media of spreading panic and paranoia.
“Today we have information, that because we have a more tropical climate [in Brazil] we’ve almost reached the end [of the pandemic], or it’s already over (…) the virus doesn’t spread as fast in warm climates like ours” (18 March)
While he was at his most vocal and dismissive in March, he has continued to rail against measures that he deems “dictatorial” such as the closing beaches or requirements to wear face coverings.
On Monday, he made further changes to a law which would require Brazilians to wear masks in public.
He has attended a number of public events without a mask, even when local rules required him to wear one.
On Sunday, Foreign Minister Ernesto Araújo posted a photo on social media showing himself with President Bolsonaro and others attending an Independence Day celebration at the US embassy in Brasilia.
None of those in the photo is wearing a mask or observing social distancing.
The US embassy said that the ambassador had had lunch with Mr Bolsonaro and others on 4 July. It added that the ambassador had no symptoms but that he would undergo testing.
The ambassador had earlier tweeted a picture of himself with President Bolsonaro.
Mr Bolsonaro’s previous three tests for the virus all came back negative.