Two batteries were heated to 250C and observed using both a thermal camera and a powerful synchrotron X-ray, to trace how faults arise and spread.
The researchers stressed that these are extreme conditions that most batteries never face; they aim to help improve the safety of future battery designs.
The study is published in the journal Nature Communications.
"We all walk around with lithium-ion batteries in our pockets every single day - and by and large, nothing goes wrong," said senior author Paul Shearing, from University College London.
"We're very positive about these batteries. But we're also conscious of the fact that as we move from iPhones and digital cameras and laptops, to things like aerospace batteries and aeronautical batteries and electric vehicles - these batteries are operating in more and more demanding conditions."
Dr Shearing and his colleagues want to understand exactly how lithium batteries fail, to help design safety features for "the absolute worst-case scenario".
Previous research has largely been limited to post mortem-type analysis of the charred remains of a failure. This team wanted to watch events unfold.
"People have looked before and after, but the exciting stuff happens very very quickly, so you need very fast imaging capabilities to be able to look at it in detail," Dr Shearing said.
So the team took their batteries to the European Synchrotron Research Facility in Grenoble, France. This huge particle accelerator produces strong X-rays that allowed the team to look right inside the batteries, while they studiously exceeded the manufacturer's safety instructions.
Two commercial lithium cells were placed on a special rotating platform and targeted with a heat gun for several minutes, until deliberate disaster struck. The constant spinning allowed the synchrotron X-ray to view the batteries from all angles and build up an evolving picture of the meltdown.
"We could watch the materials start to break down inside the battery, in three dimensions," said first author Donal Finegan, a PhD student in Dr Shearing's laboratory.
A thermal camera also recorded live footage of the batteries gradually warming up and then exploding.
The key moment the engineers wanted to observe was "thermal runaway", where so much heat is produced that it causes an escalating chain reaction. It took 161 seconds to reach this point inside one battery, and 217 seconds in the other.
The second battery had a cylindrical support built into its core, which the results show could offer a "huge advantage" under these extreme conditions, Mr Finegan said.
But crucially, the high-speed, 3D analysis revealed unseen details of how the thermal runaway begins and spreads.
At a certain point, components begin to break down and pockets of gas appear. "This is where the thermal runaway is starting," Dr Shearing said. This spreads from point to point as the footage rolls on.
"There's a sort of trail of destruction through the battery. You can see the electrodes crumbling and falling to pieces, and when it gets to really high temperatures you see metal components melting within the battery."
This molten metal indicates temperatures higher than 1000C, he explained.
Once this happens, the battery does not last long. In both cases, molten contents spewed out of the cells' vents, designed to release gas in a less catastrophic failure.
The battery without an internal support actually blew its top.
There were some tense times surrounding those key, explosive moments, Dr Shearing said.
"I remember at one point, even through the thick lead-lined door, we heard an explosion happening. That was very exciting because we knew that we were recording the X-ray data at the point when that explosion had happened.
"That was followed by a period of tens of minutes when we had to wait, before it was safe to go back inside this lead-lined experimental station."
Watching nervously on CCTV, he and his colleagues couldn't tell whether all the instruments were still intact. "We were anxious to get back in, recover the battery and make sure that we hadn't damaged anything."
Now they have their first findings, the team is analysing more experiments in which they subjected batteries to different types of mistreatment - electrical instead of thermal overload, for example.
And they don't want to stop there. They think their method could be useful for blowing up, and improving, various types of battery in the future.
"We've demonstrated this as a capability that could be more widely applied to different batteries, with different geometries and chemistries, and under different extreme conditions," Dr Shearing said.
Follow Jonathan on Twitter

Sum: Engineers have produced a detailed 3D view of overheated lithium-ion batteries failing and exploding.


Donovan Kitching, from St John's in the Isle of Man, pleaded guilty in September to causing the death of Gwen Valentine from Winchester, Hampshire.
She was visiting family when she was struck by a car driven by Mr Kitching on the Tholt-y-Will Road on 26 April.
Deemster Alastair Montgomerie passed the sentence at Douglas courthouse.
Speaking to Ms Valentine's family, Mr Montgomerie said: "No sentence can cure your anguish, no sympathy that I can express can alleviate your suffering.
"All I can hope is that to some degree the finalisation of these court proceedings can assist you in moving on with your lives."
Kitching received eight years for causing death by dangerous driving and two years and 72 days for breaching his licence. The sentences will run consecutively.
The court heard he was under licence, having been released from jail three weeks earlier after serving a sentence for burglary.
Mr Montgomerie said the sentence reflected aggravating circumstances including the fact Kitching had never had a driving lesson, had never held a driving licence, had no insurance and had just failed a road-side breath test.
After he was stopped for drink-driving, Kitching assaulted the police officer and drove away.
He lost control of the car moments before knocking over Ms Valentine.
The court also heard that he had been in possession of Class A drugs and had fled the scene of the crash to avoid arrest.
Ms Valentine, 62, was preparing for her wedding in June having retired a week earlier.
The mother of three's fiance and son were both with her when she died.

Sum: A 30-year-old man who admitted causing the death of a woman by dangerous driving has been sentenced to 10 years and 72 days in prison.


It beat some 400 organisations to top Stonewall's 2016 list of best employers for lesbian, gay, bisexual and transgender (LGBT) staff.
The survey assessed staff engagement, career development and other factors.
MI5 director general Andrew Parker said it was "a great acknowledgement of the continued progress we have made".
Stonewall said MI5 had demonstrated its equality in 10 areas of employment policy and practice, including networking groups, training and community engagement.
More than 60,000 staff from across the 400 organisations took part in an anonymous survey about their employers' attitudes.
MI5's Mr Parker said: "Diversity is vital for MI5, not just because it's right that we represent the communities we serve, but because we rely on the skills of the most talented people whoever they are, and wherever they may be."
Stonewall named Leicestershire County Council (7th overall) as the the top performing local authority, Cheshire Fire and Rescue (13th) as best emergency service, and Cardiff University (20th) as top educational organisation.
Ruth Hunt, Stonewall's chief executive, said top-ranking organisations were not only improving the lives of their staff but also "reaping business benefits".
"We know that people perform better when they can be themselves and it's been proven that diversity among staff leads to a more productive, positive and creative workplace environment," she said.

Sum:
The security service MI5 has been named as the UK's most gay-friendly employer, following a survey by a leading gay rights charity.