Apache Oil Corp. (APA) was the leading energy stock Friday as shares spiked on news that the company had sold a third of its Egyptian assets to the Chinese giant Sinopec ($SHI), both for a better price than had been expected, and much earlier than the previously assumed 2014 sale date.

With a market cap of $30.83 billion, Apache is the world’s seventh largest independent oil and gas company. The joint venture announced with Sinopec was notable for its timing, as last month’s military coup has cast doubts over the social and political stability of the Arab world’s most populous country. A violent military crackdown on supporters of deposed President Mohammad Morsi has claimed well over a thousand lives in less than two months.

But the price of the deal was also to the liking of investors, who were not expecting Apache to make $3.1 billion from the sale. Sinopec’s purchase values the entire operation at $9.3 billion, while previous estimates had it at $7.7 billion.

Egypt, though not in any sense a major producer of energy, does have some reserves of natural gas and oil. The country currently accounts for 20 percent of Apache’s production, and some 25 percent of its income. Investors have been concerned about the prevailing situation in the country, however, and the deal goes some way to allaying those fears. Chinese companies have made significant inroads into many parts of the African continent in recent years, and have in many cases become the preferred source of foreign investment for countries wishing to maintain some separation between business and politics.

From Apache’s perspective, the deal comes at a time when the company is trying to cut the dead weight from the $16 billion it has spent on acquisitions over the past few years. The company, like many others in the industry, has been slimming down to set its sights on North American on-shore reserves. It is also not the only American oil company trying to reconfigure its ties to Egypt. Over 2013, oil majors such as Royal Dutch Shell ($RDS.A) and Chevron (CVX) have sold their Egyptian assets to the French giant Total SA (TOT) .

Shares for Apache were up 7.5 percent in midday trading to $84.50, and have advanced just shy of a percent year-to-date.

[Image courtesy of Wikimedia Commons]