He said France would not surrender its core values after visiting the Notre-Dame basilica in the southern city. An extra 4,000 troops are being deployed to protect churches and schools.
In Nice, one elderly victim was "virtually beheaded", officials said. Another woman and a man also died.
A male suspect was shot and detained.
Anti-terror prosecutors have opened an investigation into the attack and France has raised its national security alert to its highest level.
French anti-terrorist prosecutor Jean-François Ricard later said the attacker was seriously wounded by police.
Mr Ricard said the suspect was a 21-year-old Tunisian national who had arrived in France earlier this month. He had a document issued by the Italian Red Cross.
Police sources earlier named the attacker as Brahim Aioussaoi. They said he had travelled by boat from Tunisia to the Italian island of Lampedusa in September. He was placed in coronavirus quarantine there before being released and told to leave Italy.
Nice Mayor Christian Estrosi spoke of "Islamo-fascism" and said the suspect had "repeated endlessly 'Allahu Akbar' (God is greatest)".
Two other attacks took place on Thursday, one in France and one in Saudi Arabia.
A man was shot dead in Montfavet near the southern French city of Avignon after threatening police with a handgun.
A guard was attacked outside the French consulate in Jeddah in Saudi Arabia. A suspect was arrested and the guard taken to hospital.
Speaking after visiting Nice, President Macron said: "If we are attacked once again it is for the values which are ours: freedom, for the possibility on our soil to believe freely and not to give in to any spirit of terror.
"I say it with great clarity once again today: we won't surrender anything."