After losing more than £3bn in 2012, Japan’s tech giant is fighting its way back to record profits under Kazuo Hirai, partly by working with Apple rather than trying to beat it. Investments in PlayStation and TV production have also helped.

Six years after reporting its biggest-ever loss, Sony is no longer a conglomerate in freefall. Last week the Japanese group behind the Bravia TV set, the PlayStation, Beyoncť and the Spider-Man films said it was on track to set a new annual profit record – expecting to beat its previous corporate best of •526bn (£3.5bn) by 20%.

It has been a long journey for the group after years of underperformance and missed targets, including most recently a £800m writedown of its Sony Pictures film division. But at last week’s quarterly results update, the company stated that the film unit was one of the company’s strongest performers and would help it beat the record profits it made in 1997-98: the year it released Men in Black, and when Steve Jobs had yet to release the Walkman-killing iPod.

Now, Sony is expected to make full-year profits of £4.2bn. If the forecast proves correct, it will be the fruit of extensive restructuring efforts launched by Kazuo Hirai, who took over as chief executive from Sir Howard Stringer in 2012, in the wake of Sony reporting the biggest loss in its 71-year history, of more than £3bn.

For years a symbol of Japan’s technological prowess, Sony had paid the price for being wrong-footed by rivals quicker to invest and develop new technology, such as South Korea’s Samsung in smart TVs and Apple in devices such as the iPod and iPhone.

“Consumer electronics went through a difficult phase when traditional [Sony] product categories like analogue TV and Walkmans were disrupted by new products with better capabilities provided by new companies that took market share,” said Damian Thong, a Japan-based analyst for investment bank Macquarie.

“Sony was slow to respond to these threats … And when they did there was an ongoing debate about how they should address it. The company used a lot of resources and wasted significant opportunities. They took their eye off the ball. For many years, Sony saw its traditional leading presence in consumer electronics slip away.”

In stepped Hirai, who had been a major force in the success of the PlayStation game console, which remains Sony’s crown jewel. The lifelong Sony employee decided to emulate Steve Jobs’s strategy for turning around an ailing Apple when he rejoined the company in the late 1990s: less is more.

He took the axe to Sony’s sprawling consumer electronics business, focusing only on areas in which it had a realistic chance of competing. It pulled out of areas such as personal computers, lithium batteries for phones and niche hard-to-justify ventures such as digital alarm clocks. As a result, products like the Bravia TV have flourished under a less distracted management.

“The company wanted to focus resource on producing the best possible products,” says Thong. “Make a few products but make them very good. This is what Apple did in its turnaround phase. Sony wasn’t as extreme as Apple, but look at the line of new products in the past few years: examples include one of the best TVs out there, and cameras.”

While Sony’s own smartphone business has continued to shrink in the face of fierce competition (sales have fallen from 33 million units in 2012 to just 14.6 million last year), Hirai cleverly moved into providing the smartphone image sensors – which help cameras focus and increase image quality – found in all mobile phones.

Now Apple, with its popular iPhone, is now one of Sony’s most valuable partners, helping drive revenues for the division from zero to £5.89bn in a few years. Macquarie estimates Sony has captured half of the global market for this technology. With an eye on the next opportunity, Sony is upping its investment in image sensors for driverless cars.

Hirai’s other major focus has been to keep the PlayStation juggernaut on track. Sales of the PS4 will reach 80 million units this year, and the games division, including its online PlayStation network of 70 million paying users, is the single biggest contributor to Sony’s revenue. This year the division will account for 24% of revenue and almost 29% of operating profit.

“It has sold faster than any other PlayStation, accounts for almost a third of profits and has outsold Microsoft’s Xbox by a factor of two,” said Thong.

Business is also looking up for Sony Pictures, which is set for its best year at the box office since 2014 thanks to films such as Spider-Man: Homecoming, Baby Driver and Blade Runner 2049. Renewed optimism over the film unit comes only months after a $1bn writedown, fuelling speculation that it could be sold.

Until recently the studio was hampered by the blockbuster-driven nature of Hollywood success: Spider-Man is its only global franchise, with the latest film pulling in $900m globally. But the rise of high-end TV production has proved a boon: Sony’s TV arm is a co-producer of Netflix’s £100m epic The Crown and other credits include Breaking Bad and US hit The Blacklist.

“In 2012, film was more than 60% of the film and TV division revenues; by the end of last year it accounted for less than half,” says Richard Broughton, of Ampere Analysis, who adds that selling content to streaming businesses like Netflix and Amazon has become a key earner for Sony.

TV and film licensing, to Sky, Netflix, Amazon or whoever are an increasingly important, stable and growing revenue stream. Over a third of Sony’s revenues are from gaming and television/film.”

Sony Music, whose artists include Beyoncť, Shakira and AC/DC, has benefited from the rise of digital services such as Spotify and Apple Music. Earlier this week, the company raised its revenue target for 2017 by 16% to £4.89bn, in part thanks to the rapid growth in streaming sales.

However, analysts said that another contributor to the division’s strong performance is the runaway success of a smartphone role-playing game called Fate/Grand Order, which was developed by an arm of Sony Music. The online game has become a surprise mega-hit in Japan, making about $300m of profit a year, according to Macquarie.

Its confidence regained, Sony is now looking for its next big hit and, like all its tech peers, has identified artificial intelligence as a potential breakthrough area. Last week Hirai made a public statement of Sony’s intent to continue to invest and innovate by reincarnating its cuddly Aibo robo-dog from the 1990s as a 21st-century AI-infused hound. The first batch sold out online in 30 minutes – further proof that Sony and Hirai could be on the right track.