Stock market turmoil in Wall Street has helped Apple pip oil group Exxon to become the world’s most valuable company.

The tech company has been closing in on Exxon for some time and was “just” $50bn (£30bn) away from taking the lead when it reported yet another quarter of record-breaking earnings on 19 July.

As the US stock markets bounced back from last week’s crash the tech firm overtook Exxon with a market value of $337bn compared to ExxonMobil’s $334bn. Exxon could easily slip back into the lead if the recent fears for the global economy subside but the gap is so close that the two look certain to be battling it out for some time.

In part Apple’s gain is down to Exxon’s loss. Exxon’s value has been hit by the economic slowdown and depressed oil prices brought about by the financial turmoil. Its shares were as high as $87.98 in April but were trading at just under $70 on Tuesday night .

Apple has shown gravity-defying growth and delivered record results after record results. Last month it produced another stellar quarter, strengthened by strong sales of its iPhones, iPads and record sales of its Mac computers.

It sold 20.34m iPhones – more than double the number in the same period last year – and 9.25m iPads, almost triple the number sold during its debut quarter in 2010.

“We’re thrilled to deliver our best quarter ever,” said Apple’s chief executive, Steve Jobs, announcing that revenues were $28.57bn, up 90% year-on-year, and profits $7.31bn, a rise of 124%. Exxon’s second quarter earnings were up a more pedestrian 41% from the second quarter of 2010.

If and when Apple secures its position as the world’s most valuable company, it will mark another milestone in a dramatic reversal of fortune for the company and its founder.

Jobs was fired from Apple in 1985 as the company lost its way and Microsoft-powered PCs seemed destined to dominate the market. When he returned to the company in 1997, the troubled firm was worth just $2bn. He led a renaissance at the company, focusing on design and innovation and setting what seemed like impossibly ambitious targets.