Image copyright Getty Images Image caption Yahoo said it is "consolidating certain functions into fewer offices, including to our headquarters"

Internet giant Yahoo is closing its China office as part of a worldwide consolidation aimed at cutting costs.

The Beijing research centre is Yahoo's only remaining physical presence in the country after it sold its Chinese operations to Alibaba in 2005.

A spokesperson said "around 350 jobs" would be eliminated.

"We are constantly making changes to align resources, and to foster better collaboration and innovation across our business," Yahoo said in a statement.

Analysis: Martin Patience, BBC News, Beijing

The news that Yahoo was closing its last remaining office in mainland China travelled fast.

Outside the Yahoo research centre, an employment agency staged a guerrilla-style PR campaign offering the sacked staff new jobs.

Many Yahoo employees appeared unimpressed as they walked by men dressed up in silver, alien outfits.

One employee said the news was "very sad." He added, "I had good relations with my colleagues and now I need to say goodbye."

The move by the internet giant, however, doesn't come as a huge surprise.

Yahoo has been rapidly retreating from the Chinese market. In 2013, it stopped offering services to email users in China.

It's had an often fraught relationship with the Chinese government. Controversially the firm handed over information to the authorities that led to the jailing of two Chinese dissidents.

But according to reports, this closure was nothing to do with government pressure or censorship. Instead it's been driven by the internet giant's desire to cut its global operating costs.

Yahoo has been struggling to maintain profit growth in the face of growing competition from rival online search portals like Google.

The Sunnyvale, California-based firm has also been trying to adapt to consumers increasingly using mobile devices, which attract less advertising revenue.

As a result, Yahoo Chief Executive Marissa Mayer has made a slew of acquisitions in a bid to diversify business and add new revenue streams.

Earlier this year, Yahoo also announced plans to spin off its stake in Alibaba, China's largest e-commerce company, which is valued at more than $30bn.

The tech giant also owns a lucrative stake in Yahoo Japan. Yahoo had a global workforce of about 12,500 workers at the end of 2014.

China operations

Yahoo is the latest US technology firm to exit operations in China.

When you're as weak as Yahoo globally, it doesn't make sense to have a research and development arm in China since its too expensive. Shaun Rein, China Market Research

Google partially withdrew in 2010 after clashing with Chinese authorities over censorship.

Earlier this year gamemaker Zynga closed its office and shed more than 70 jobs after its products failed to gain traction against local competition.

Shaun Rein, managing director of consultancy China Market Research said it was very difficult for consumer-facing foreign internet players to find success in China.

"Unlike rest of the world, they're facing well-funded, aggressive home-grown players," he said.

"In China you have really strong entrepreneurship in the online space and they're able to react quicker to consumer trends."

Mr Rein added that it makes sense for Yahoo to "cull through headcount and business lines that aren't making a profit".

"When you're as weak as Yahoo globally, it doesn't make sense to have a research and development arm in China since its too expensive."