The attack, which unnerved the large foreign community here took place outside a shopping mall in the Chaoyang District last evening.
Hundreds of bystanders witnessed the incident, state-run Xinhua news agency reported.
An official spokesman said police apprehended the suspect, a 27-year-old man surnamed Xiao from east China's Shandong Province, on the spot after being alerted to the attack.
The suspect has claimed that he is mentally ill.
According to a preliminary police probe, the unemployed man arrived in Beijing at the beginning of June.
Beijing police have contacted their counterparts in the suspect's home province in order to obtain more information about the man's medical history.
No information on the man's motive for the crime was immediately available.
China in recent years has witnessed such incidents, stated to be social revenge attacks, many of them directed against primary school children but this is the first time a foreigner was targeted.
Few details have been made public in such cases except to say that they attackers were mentally deranged and suffering from psychological problems.
