(Adds details, background)
TRIPOLI, April 2 (Reuters) - Libya could finalise an agreement in two to three days with rebels to reopen vital oil ports, a government spokesman said on Wednesday, bolstering hopes for an end to an eight-month stalemate that has dried up oil revenue.
On Tuesday, rebel leaders said their group would reach an agreement within days to end the blockage of three ports that previously accounted for 600,000 barrels of oil exports a day.
"Negotiations are still ongoing, but we expect an agreement to open the ports," a spokesman for interim Prime Minister Abdullah al-Thinni said, in the first official comment since rebel leader Ibrahim Jathran announced a pact late on Tuesday.
The spokesman said such a deal, mediated by tribal elders, could be completed in less than a week, possibly two to three days.
He said the deal would focus on compensation for the rebel fighters, who had defected from the state oil security force along with their leader Ibrahim Jathran in summer when they seized the ports.
A solution would also address the rebel demand to use efficient metering systems to improve monitoring of oil sales and avoid corruption.
Jathran had also demanded regional autonomy and a share of oil wealth for the east of Libya in a federalist system like that under King Idris, who preceded Gaddafi.
Thinni's spokesman said such political goals had been separated from the talks, which were mediated by tribal elders. "Such big demands are undermining the state or the government," he said.
The oil conflict is just one aspect of the turmoil in the OPEC producer, where a weak central government is unable to control militias that helped topple Muammar Gaddafi in 2011. They now refuse to disarm and are trying to take a share of power or oil wealth.
Talks with the eastern rebels moved forward after the U.S. Navy captured a tanker that had loaded oil at a rebel port, killing the hopes of rebel leaders to bypass Tripoli to sell crude and pressuring them to agree on a deal.
In a speech late on Tuesday, Jathran announced a deal without giving details. He had toned down his often martial speech and focussed on the need to achieve democracy and stability in Libya by reaching out to all regions.
Western powers worry that the conflict over oil will fuel instability or even break up the vast desert country as many in the east complain of decades of neglect at the hand of western cities, such as Tripoli and the main port Misrata.
A deal, if confirmed, would not necessarily end the shutdown of several oilfields in western Libya by a different set of protesters.
In contrast to the east, protesters at western oil facilities such as the closed El Sharara field are divided into small groups with different demands and lack joint leadership.
Output has fallen to around 150,000 barrels per day from 1.4 million bpd in July when a wave of protests started across Libya. The loss of oil revenues has triggered the worst budget crisis for decades as the central bank has burned through its reserves to keep the country afloat.
With no real army, Libyan authorities are struggling to control militias and armed tribesmen, who helped to oust Gaddafi in the 2011 civil war but have become political players controlling territory and seizing oil facilities at will.
(Reporting by Ulf Laessing; Editing by Dale Hudson and Jane Baird)