"A police officer has been stabbed in the back and the neck," inspector Ronnie Tellberger told AFP, saying the assailant attacked him from behind.
The suspect was arrested at the scene, a witness told AFP.
The motive for the attack was not immediately clear.
"There's nothing to indicate at this point that this was terror-related," Stockholm police spokesman Lars Bystrom told AFP.
"As I've understood things, it seems this was totally unprovoked," he said.
The attack comes almost five months after an Uzbek asylum seeker deliberately ploughed a truck into shoppers in central Stockholm, killing five people including an 11-year-old girl.
Thursday's incident occurred around 10:30 am (0830 GMT) near a subway exit in Medborgarplatsen Square in the Sodermalm neighbourhood.
"A preliminary enquiry has been opened into attempted murder," Stockholm police said in a statement.
The police officer was taken to hospital, but was released several hours later, Bystrom said.
The witness told AFP the attack "happened so quickly, there was barely time to notice anything," but that he saw police arrest a man at the scene.
(Except for the headline, this story has not been edited by NDTV staff and is published from a syndicated feed.)