Mohammad Ashfaq, a local police chief, says more than two attackers stormed the consulate on Friday.
Pakistani security forces quickly surrounded the area.
The consulate is home to Chinese diplomats and other staff.
According to a defence contractor who provides armed guards to the Chinese consulate, the attackers attempted to enter the consulate building after killing the two policemen.
Three gunmen tried to enter the consulate in the southern port city, but were intercepted by guards at a checkpoint. Pakistani workers involved in CPEC projects have come under attack by insurgents in recent years. "Pakistan and China have joint security attempts to prevent such attempts at destroying the work that the two countries are working on".
In a statement from State Department Spokeswoman Heather Nauert, the United States condemned the attack and commended "the Pakistani security forces' quick and fearless response ... that prevented further loss of life".
China, which neighbours Pakistan, is a close ally and the country's main benefactor, investing huge amount of money in infrastructure projects.
Pakistan's efforts to quash the insurgency in the oil and gas-rich region have intensified as Beijing is developing the area's key CPEC port, Gwadar.
Trump denies that Ivanka's use of private email is like Clinton
Hillary Clinton speaks onstage at the 2018 Glamour Women Of The Year Awards: Women Rise, Nov. 12, 2018, in NY . An unnamed senior USA government official called her the "worst offender in the White House".
"There were three suicide attackers", Jiand Baloch of the Balochistan Liberation Army (BLA), which also describes itself as the Baloch Liberation Army, told Reuters.
"India strongly condemns the terrorist attack on the Chinese Consulate in Karachi this morning".
In an apparently unrelated attack that occurred hours after the assault on the consulate, a bomb blast targeted a Shiite community in Pakistan's remote northwest province, killing at least 31 people.
Pakistan's Prime Minister Imran Khan condemned the bombing, saying it was an "act of terrorism". Two policemen and all three terrorists were killed in the encounter.
The BLA spokesperson blamed China for "exploiting" the nation's "resources".
However, there has always been resentment in Balochistan against Chinese investments in the province, particularly those that pertain to the development of the port of Gwadar. "The perpetrators of this heinous attack should be brought to justice expeditiously", said an official statement issued by the ministry.
Raffaello Pantucci, director of global security studies at the London-based Royal United Services Institute for Defence and Security Studies, said the attack was "reflective of a growing China focus by the BLA".