They also blew up a PC3 Orion aircraft in one of the most brazen attacks in years.
Pakistani security personnel are still battling with the militants holed up at the Pakistan Air Force's Faisal airbase which also houses PNS Mehran, the naval air station, the country's Interior Minister Rehman Malik said.
"I can confirm that security forces have killed six of the attackers while the rest are holed up in one building of the air station and are fighting a losing battle," Malik told Aaj television channel.
Malik said heavy contingents of special naval and military commandoes and other security forces have been rushed to the base to control the situation.
Earlier, officials of the Citizens Police Liaison Committee confirmed that at least four naval personnel were killed. While other officials said six persons were injured, including a foreigner.
A Pakistan Navy spokesman, meanwhile, confirmed that two naval officers were injured in the attack.
Prime Minister Yousuf Raza Gillani reportedly spoke to the heads of all three armed forces asking them to take immediate action to control the situation.
The terrorists, numbering between 12 and 15, targeted PNS Mehran where some Chinese engineers were reportedly engaged in work within the Faisal airbase, at about 10.40 pm, sources said.
The armed men lobbed several grenades and exchanged heavy fire with security forces. The firing died out at about 11.30 pm but erupted again at midnight.
The militants apparently entered the Naval base and hangers through the Pakistan Air Force museum, a source said.
"They took advantage of the fact that people at that time were leaving for home from the PAF museum inside the Faisal base," the source said.
Dawn News channel quoted witnesses as saying that they had heard up to five blasts. Heavy firing continued for over 20 minutes after the first blast occurred, following which there were reports of intermittent firing.
Hundreds of paramilitary personnel surrounded the airbase while commandos from the army''s elite Special Services Group were sent in to sweep the area.
Footage on television showed ambulances rushing to the airbase.
The high-security area where the attack occurred also houses the PAF's Southern Air Command, Air War College and museum as well as PNS Mehran.
Militants had also attacked two Naval buses in April in which around seven people were killed.