LIBREVILLE, Oct 3 (Reuters) - Gabon's government has agreedto trade union demands to limit the number of foreign workers inits oil sector to 10 percent and to require all executive poststo be held by Gabonese, oil sector union ONEP said on Sunday.

Legislation to implement the limits will be finalised by theend of the year, said ONEP spokesman Arnaud Engandji, adding oilfirms in the central African state would have two years toadjust to the 10 percent limit and six months for what he calledthe "gabonisation" of all executive positions.

Engandji said an accord on the limits was signed Friday byOil Minister Julien Nkoghe Bekale, Labour Minister Maxime NozoIssondou and ONEP Secretary-General Guy-Roger Aurat Reteno.

The deal averts the risk of a strike in Africa's seventhlargest crude oil producer, one of the few in sub-Saharan Africato have launched a Eurobond.

Gabon produced about 250,000 barrels of oil per day in 2008,according to U.S. Energy Information Administration data.Foreign investors include Royal Dutch Shell, Total, Tullow OilPlc, Canadian Natural Resources and many others.

A recent report estimated that foreign workers held 1,893 ofthe total 8,590 staff in the sector, with Gabonese holding just17 percent of executive posts.

Oil accounts for around half of Gabon's $14.5 billion-a-yeareconomy, a dependence it is trying to reduce through an economicdiversification programme. (Reporting by Phal Mezui Ndong Gualbert; writing by Mark John;editing by Andrew Dobbie)