The attack was claimed by the outlawed Baloch Liberation Army (BLA) which said it would not tolerate “any Chinese military expansionist endeavours on Baloch soil".
The consulate, located in the posh Clifton area, came under attack early morning.
Three suspected suicide bombers were killed before they were able to enter the facility as forces successfully foiled the attack, Karachi Police chief Amir Shaikh said.
Nine hand grenades, Kalashnikov assault rifles, magazines and explosives were recovered from the possession of the terrorists, Geo news quoted police officials as saying.
“Food supplies and medicines were also recovered from their possession," officials said.
“We have received two dead bodies of policemen and an injured Chinese security guard who is under treatment," said Seemi Jamali, the executive director at Jinnah Hospital.
Two civilians, a father and his son were also killed, officials said.
The Sindh government and the Pakistan Army confirmed that three terrorists were killed in the operation.
The heavily-guarded E-Street neighbourhood, which is considered a red zone, is home to a number of upscale restaurants, diplomatic missions and schools.
The Bilawal House of Pakistan People’s Party chairman Bilawal Bhutto Zardari is also in the area. Schools and eateries have been locked down until a clearance operation is concluded.
Residents said they first heard firing and explosions around 9.30 AM (local time).
“The terrorists first attacked the checkpost outside the consulate and detonated a hand grenade in the area," Shaikh said.
Shaikh said the attackers had parked their vehicle at some distance from the consulate before moving towards it.
Defence analyst and security contractor Ikram Sehgal, whose company’s guards have been posted at the consulate, said that the attackers had first engaged in an exchange of fire with policemen.
After the policemen and civilians were killed, he said, the attackers proceeded towards the gate of the consulate. However, the guards were quick to usher civilians with consular business into the building and shut the gates behind them.
The paramilitary rangers then reached the spot and engaged the attackers, he said.
Sheikh said that all Chinese staffers “are safe and secure".
The separatist group BLA shared the photographs of the attackers.
“Karachi: Fidayeen of BLA attacked the Chinese embassy in Karachi," it said in a tweet.
BLA has been designated as a terrorist entity by Pakistan.
The Foreign Office spokesman said that Islamabad is “in touch with the relevant agencies and will react quickly" to ascertain the facts.
Prime Minister Imran Khan took to Twitter to condemn the attack.
“Strongly condemn the terrorist attacks against Chinese Consulate in Karachi & in Orakzai tribal area. My prayers go to the victims & their families. Salute the brave security/police personnel who gave their lives & denied success to terrorists in the mission against Chinese Consulate," he said.
“The failed attack against the Chinese Consulate was clearly a reaction to the unprecedented trade agreements that resulted from our trip to China. The attack was intended to scare Chinese investors and undermine CPEC. These terrorists will not succeed," Khan said.
Sindh Chief Minister Murad Ali Shah contacted the Chinese consul general and assured him that the situation will be taken under control.
Governor of Sindh Imran Ismail has sought a report on the attack from the Sindh inspector general of police.
In Beijing, the China’s foreign ministry strongly condemned the attack on its consulate and urged its all-weather ally to take “practical measures" to ensure the safety of Chinese citizens in the country, mostly on projects linked to the $60 billion China-Pakistan Economic Corridor (CPEC).
Hundreds of Chinese nationals are presently working in Pakistan specially in Karachi and the restive Balochistan province on projects of the CPEC and on other business ventures.
Chinese nationals in Karachi generally consider it a safe city to move around, carrying out their day-to-day business.
In February, a senior Chinese shipping executive was killed when unknown assailants opened fire on his vehicle near Zamzama park also in the Clifton area.
Sindh police chief Kaleem Imam said that security has been beefed up for the Chinese nationals and a comprehensive security plan would be drawn up to ensure they are under a security cover round the clock.
It is the first major terror strike in Karachi since March, 2016 when 45 Ismaili Muslims were killed in a targeted attack.
Since then, there had been calm in the country’s financial hub as police and the paramilitary rangers have kept up a constant operation against militants, killing dozens of them in different parts of Karachi.
Friday’s attack will leave the government and security forces concerned as the Chinese mission is located in a densely populated area.
This story has been published from a wire agency feed without modifications to the text.