At least two US marines died when militants breached the perimeter of the sprawling base in Helmand province.
The Taliban told the BBC that they carried out the attack in revenge for a film mocking Islam which has triggered protests around the Muslim world.
Aircraft and buildings were damaged but Nato says its forces killed 18 of the insurgents and captured one.
Camp Bastion is situated in the middle of the desert with excellent visibility all around, says the BBC's Jonathan Beale in Kabul.
The attack came after at least seven people died in protests over the film mocking the Prophet Muhammad in Khartoum, Tunis and Cairo on Friday and amid fears of further unrest.'Engulfed in fire'
Nato officials say insurgents used small arms, rockets and mortars in the attack on Camp Bastion which took place at about 22:00 on Friday (17:30 GMT), under cover of darkness.
Major Adam Wojack, from Isaf joint command in Afghanistan, said the attackers found a "vulnerable part of the perimeter" and quietly breached it.
Once inside, the insurgents attacked the airfield side of the compound and caused "some damage to aircraft, damage to structures and killed those two marines", the officer said.
The attack was finally fought off by mainly American and British personnel who "ended up killing 18 of those attackers", he said.Update: Taliban fighters attacked the coalition base at Camp Bastion-Camp Leatherneck in Helmand Province just before midnight local time with small-arms fire and rocket attacks, according to U.S. officials.
A U.S. official said Prince Harry is safe and was not affected by the attack. The British Defense Ministry said today that Prince Harry had been deployed to Camp Bastion along with his Apache helicopter unit. It is Prince Harry's second deployment to Afghanistan.
A Taliban spokesman had said days after the announcement of Harry's deployment that they would try to kill him while he's in Helmand Province.
"We will do our best to kill Prince Harry and Britain's other troops based in Helmand," Zabihullah Mujahid said. "It is not important for us to kidnap him. We will target him and we will kill him."
The coalition camp houses as many as 28,000 international troops. The British side of the base is known as Camp Bastion, the adjoining U.S. facility is called Camp Leatherneck. Defense officials say the casualties and damage to buildings and aircraft occurred on a Marine portion of the base located at Camp Bastion.
A Defense official said two Harrier fighter jets flown by U.S. Marines were damaged in the attack.