Police in Beijing said they had arrested a 34-year-old, man over yesterday's fatal stabbings in Huairou district in the northern part of the capital.
The suspect was reported to have a history of mental illness.
Earlier, a man stabbed seven fellow villagers in the southern region of Guangxi, seriously injuring a four-year-old boy and a woman.
The man, surnamed Lu, had attacked seven people, including two children, in his village on the outskirts of Qinzhou city.
He was taken into custody at the local police station for questioning.
The attacks come as China is still jittery after a mass stabbing at a train station in the southwestern city of Kunming earlier this month left 29 people dead and around 140 injured.
The government blamed that attack on militants from Xinjiang, the far western region that is home to a large Muslim Uighur minority.