The victim is said to have shown controversial cartoons of the Prophet Muhammad to his pupils. The attacker was shot dead by police.
Mr Macron said the as yet unnamed teacher was murdered because he “taught freedom of expression”.
“They won’t win… We will act,” the president said from the scene.
The attack occurred at about 17:00 local time (15:00 GMT) near a school. Anti-terror prosecutors are investigating.
The knife-wielding attacker was shot as officers tried to arrest him in the aftermath of the attack. Police have not released any personal details about him.
A trial is currently under way in Paris over a 2015 Islamist assault on the French satirical magazine Charlie Hebdo, which was targeted for publishing the cartoons.
Three weeks ago, a man attacked and wounded two people outside the magazine’s former offices.
What do we know about what happened?
A man wielding a large knife attacked the teacher in a street in an area called Conflans-Sainte-Honorine, cutting off his head. A police source said that witnesses had heard the attacker shout “Allahu Akbar”, or “God is Greatest”, the Reuters news agency reported.
The attacker then ran off, but local police alerted by the public were quickly at the scene.
The officers confronted the man in the nearby district of Éragny.
When they shouted at him to give himself up, he is said to have threatened them. The officers shot him and he died a short time later.
The scene is now sealed off, as the investigation continues.
Four people, including a minor, have been arrested, a judicial source told AFP early on Saturday. Those arrested were related to the attacker, the source said.
In a tweet (in French), police urged members of the public to avoid the area.
French broadcaster BFMTV reported that the suspected attacker was an 18-year-old man who was born in Moscow.
Who was the victim?
According to Le Monde newspaper, the victim, a teacher of history and geography, had been talking in class about freedom of expression in connection with the Muhammad cartoons, which caused uproar among some Muslims when Charlie Hebdo published them.
The teacher had reportedly advised Muslim students to leave the room if they thought they might be offended.
Earlier this month, some Muslim parents complained to the school about the teacher’s decision to use one or more of the cartoons as part of a discussion about the Charlie Hebdo trial, French media report.
Reacting to Friday’s attack, Charlie Hebdo tweeted: “Intolerance just reached a new threshold and seems to stop at nothing to impose terror in our country.”
If this motive for the killing is substantiated, it will be deeply shocking to the French, says the BBC’s Hugh Schofield in Paris. They will see it as not just a brutal attack, he says, but a brutal attack on a teacher for carrying out his duty to explain.
France has seen a wave of Islamist violence since the 2015 attack on Charlie Hebdo that left 12 people dead, including famous cartoonists.
The murder bore the hallmarks of “an Islamist terrorist attack,” Mr Macron told reporters at the scene of the attack.
“One of our fellow citizens was assassinated today because he was teaching, he was teaching pupils about freedom of expression,” he said.
In the National Assembly, France’s parliament, deputies stood up to honour the teacher killed on Friday and condemn the “atrocious terror attack”.
Interior Minister Gerald Darmanin, travelling to Morocco, is returning urgently to Paris.
Education Minister Jean-Michel Blanquer tweeted that the killing of a teacher was an attack on the French Republic.
He said his thoughts were with the victim and his family, and unity and firmness were the only responses to “Islamist terrorism”.