An al-Qaeda-linked group claims it is holding 41 foreigners, including US, French, British and Japanese citizens at the facility near In Amenas.
It says the attack is to avenge Algeria’s support of France’s operation against al-Qaida-linked rebels in Mali.
The group says hostages will be freed if France ends its operations in Mali.
Algeria’s state-run APS news agency said Algerian workers at the facility had been released.
The In Amenas gas field is operated by the Algerian state oil company, Sonatrach, along with the British oil company BP and Norway’s Statoil.
It is about 1,300km (800 miles) south-east of the capital, Algiers, and about 60km west of the Libyan border.
The Algerian interior ministry said a heavily-armed “terrorist group” using three vehicles had attacked the bus carrying workers from the In Amenas gas field at about 05:00 (04:00 GMT).
The attack was initially repelled before the gunmen headed to the complex’s living quarters and took a number of hostages.
Two foreigners were reportedly killed in the attack, one of them a British national. A local source earlier told the Reuters news agency a Frenchman had died.
The UK government confirmed that “several British nationals” had been involved in a “terrorist incident”.
Norwegian Prime Minister Jens Stoltenberg told a news conference that 13 Norwegian employees of Statoil were believed held hostage at the gas facility.
American, Irish and Japanese hostages were also taken.
BP said gunmen had occupied the In Amenas operations site, but Algerian forces have surrounded the area.
The French catering company CIS told the BBC that 150 of its Algerian employees were still being held at the site.
However, a spokesman said they were “allowed to move around… unlike the foreign hostages, who are trapped in a corner and cannot move”.
A man claiming to be a spokesman for the militants told BBC Arabic that al-Qaeda had carried out the attack.
He claimed that they had allowed Algerian workers to leave the gas facility and were only holding foreign nationals.
A list of demands had been sent to the Algerian authorities, and the hostages would be killed if troops attempted to rescue them, the spokesman added.
”Storming the gas complex would be easy for the Algerian military, but the outcome of such an operation would be disastrous,” he warned.
Earlier, a group known as the Khaled Abu al-Abbas Brigade claimed responsibility.
The Khaled Abu al-Abbas Brigade is believed to be led by Mokhtar Belmokhtar – also known as Abu al-Abbas – who was a senior commander of al-Qaeda in the Islamic Maghreb (AQIM) before late last year, when he set up his own armed group after apparently falling out with other leaders.
His new group is also known as the Signed-in Blood Battalion, whose spokesman told ANI that it had taken more than 40 hostages, including seven Americans, two French citizens and two British citizens.
“We are holding the Algerian and French governments, and the hostages’ countries, entirely responsible for their slowness in satisfying our demands, foremost of which is an immediate halt to the aggression against our brothers in Mali,” added the spokesman.
Militant groups have vowed to avenge France’s military intervention in Mali, where its forces have been battling Islamists linked to AQIM for the past week.