The incident comes amid a tumultuous period in Brazil's history that has seen a sweeping corruption investigation roil the political establishment and inflame Brazilian citizens still suffering after a devastating, two-year recession. A medical team is evaluating whether Mr Bolsonaro can be transferred to another hospital in Sao Paulo.
The attack comes at a time of increasingly heated rhetoric, and sometimes violence, related to campaigns and candidates. Not being able to go out in the streets could affect his campaign. He was immediately taken to a local hospital and his son tweeted that his father's wounds were "only superficial" and said he "is OK". He says the attack will only help his father electorally.
Mr Bolsonaro is in serious but stable condition and will remain in intensive care for at least seven days, the doctor said. Ibope said its most recent survey showed Mr Bolsonaro losing to him by just one percentage point.
Despite being a congressman since 1991, Bolsonaro is running as an outsider ready to upend the establishment.
Police said a suspect was taken into custody, but there was no immediate word on his or her motive.
His statements about women, minorities and LGBT (lesbian, gay, bisexual and transgender) people have repelled some Brazilians, but attracted many others who support his free-market policies and hard-line law-and-order stance.
In casting his vote on the floor of Congress for the 2016 impeachment of former president Dilma Rousseff, he dedicated his ballot to the military regime figure who oversaw the prison where Rousseff was jailed for three years and brutally tortured.
But Bolsonaro also faces trial before the Supreme Court for speech prosecutors claim incited hate and rape. He has called the charges politically motivated.
The man, police said, was jumped by Bolsonaro's supporters after the stabbing and badly beaten. It said the circumstances were being investigated.
A statement from federal police said the candidate had bodyguards.
Supporters outside the hospital in Juiz de Fora where Bolsonaro was being treated included Bruno Engler, 21, who is running for a Minas Gerais state congressional seat for the candidate's Social Liberal Party. Vitor Albuquerque, a spokesperson for the local police.
The stabbing of a leading Brazilian presidential candidate has the potential to reshape the election contest after dramatically exposing the deep polarisation in Latin America's largest nation. Fernando Haddad, the likely substitute for Luiz Inacio Lula da Silva, has 6 percent.