The police said two children and two adults were injured in the attack at an elementary school in the town of Vrutky, 140 miles northeast of the capital Bratislava.
The attacker was then shot by police after fleeing the school, which is in a residential neighborhood.
Police President Milan Lucansky said the attacker was believed to be a former student.
“He entered the school by smashing a glass door. Then some staff members tried to block and stop him, and he used a knife which he had brought with him,” he said.
The attacker seriously injured a teacher and two students in one classroom before he ran from the school, Lucansky said.
Police used their weapons after he resisted arrest.
Slovak elementary schools began reopening on June 1 under an easing of CCP virus lockdown measures.
Epoch Times staff contributed to this report