In a statement posted on a website often used by the Islamist groups, al-Qaida said two of its members carried out the attack.
It said the raid was within the framework of efforts by al-Qaida to prevent the theft of Muslims' wealth by "crusaders and Jews" and to force "infidels" out of the peninsula.
The authenticity of the statement could not be verified.
In Abqaiq, a guard manning an outer gate of the facility said security forces were combing the plant in search of any of the attackers hiding there. "The security situation is still unstable," said the guard, ushering people away.
Two cars had exploded at the gates of the huge facility after security forces fired on bombers trying to storm it.
Saudi security adviser Nawaf Ubaid said security forces fired on three cars at the outer gates, 1.5km from the main entrance.
He said that one car, carrying armed men and packed with explosives, rammed the gates.
It was not clear how many men were involved in the afternoon attack.
Security sources in Riyadh said four attackers and two security officers died and two other officers were wounded.
Mansur al-Turki, the Interior Ministry spokesman, told the state television earlier that six workers were also lightly injured.
"We have yet to determine the identity of the attackers. We are currently checking DNA samples," al-Turki said.
Ali al-Naimi, the Saudi oil minister, was quoted by the Saudi Press Agency as saying that a small fire was quickly brought under control after the incident.
Al- Naimi said oil and gas output was unaffected by the "terrorist attempt", the first direct strike on a Saudi oil target since al-Qaida fighters launched attacks directed at toppling the country's pro-Western monarchy in 2003.
A small fire was quickly brought
under control after the attack
Oil prices jumped $2 a barrel on news of the attack in the world's largest oil exporter, which came a year after Saudi-born Osama bin Laden urged his supporters to hit Gulf oil targets.
Most Saudi oil is exported from the Gulf via the producing, pumping and processing facility at Abqaiq, also known locally as Baqiq, in the mainly Shia Eastern Province.
Robert Baer, the former Middle East CIA field officer, has described Abqaiq as "the most vulnerable point and most spectacular target in the Saudi oil system".
Gary Ross, CEO at PIRA Energy consultancy in New York said: "It's not clear what damage there is, but Abqaiq is the world's most important oil facility,"
"This just emphasises fears over global oil supply security when we're already facing major ongoing risks in Nigeria, Iran and Iraq."
But Aramco says it has the tightest security at all its oil plants, including helicopters, cameras, motion detectors and thousands of armed guards.
"This just emphasises fears over global oil supply security when we're already facing major ongoing risks in Nigeria, Iran and Iraq"
Gary Ross, CEO, PIRA Energy consultancy, New York
Abqaiq handles crude pumped from the giant Ghawar field and ships it off to terminals Ras Tanura, the world's biggest offshore oil loading facility, and Juayma.
It also pumps oil westwards across the kingdom to Red Sea export terminals.
Friday's attack was the first such major strike in Saudi Arabia since bombers tried to storm the Interior Ministry in Riyadh in December 2004.
The prospect of a direct attack on Saudi crude facilities has been a doomsday scenario for oil consumer nations heavily reliant on Saudi oil.
The kingdom accounts for around a sixth of the world's oil exports, supplying 7.5 million barrels a day.