About 12 to 15 terrorists targeted PNS Mehran, the naval air station within Faisal airbase, at about 10.40 pm last night.
The terrorists lobbed several grenades, fired rockets and exchanged heavy fire with security forces.
Naval spokesman Irfan-ul-Haq told the media that four naval personnel and a paramilitary trooper were killed and nine more naval personnel injured in running gun battles with the terrorists.
State-run PTV said there were unconfirmed reports that four to five terrorists had been killed or captured.
At least one naval aircraft, possibly a P3C Orion long-range reconnaissance aircraft, was destroyed in the attack, media reports said.
Interior Minister Rehman Malik, who was despatched to Karachi by Prime Minister Yousuf Raza Gilani to monitor the situation, said the terrorists entered the airbase from three directions.
Some of the attackers were holed up in a building and were trading fire with security forces, he said.
Hundreds of security personnel, including from the paramilitary Pakistan Rangers and elite naval and army commandos, moved into the airbase to flush out the terrorists.
Authorities used helicopters to mount surveillance over the airbase after dawn.
Heavy exchanges of fire between the attackers and terrorists continued till about 11.30 pm last night, and was then followed by intermittent firing and several blasts after midnight. At least 10 blasts occurred within the airbase.
The terrorists had been surrounded by naval and army commandos and the two sides were exchanging fire, spokesman Irfan-ul-Haq said.
The cordon around the attackers was being tightened and the operation was likely to be completed soon, he said.
The terrorists targeted several hangars where the navy''s P3C Orion surveillance aircraft were parked, media reports said.
Footage on television overnight showed ambulances rushing to the airbase.
Flames and thick smoke billowed into the sky from an object burning near a four-engine aircraft that looked like a P3C Orion.
No group claimed responsibility for the attack, which came 20 days after al Qaida leader Osama bin Laden was killed in a US raid on the garrison city of Abbottabad.
The Taliban and al Qaida have vowed to avenge bin Laden's killing by carrying out attacks in Pakistan and the US.