A new technique for measuring the mass of galaxies has been applied to our closest galactic neighbour - and it has found that the Andromeda galaxy is roughly the same size as the Milky Way, and not two to three times bigger as was previously thought.

This means, when the two galaxies merge in about 4 billion years' time, the Milky Way won't be fully consumed by the Andromeda galaxy as previous models suggested.

Led by astrophysicist Prajwal Kafle from the International Centre for Radio Astronomy Research, the team found that the mass of the Andromeda galaxy is around 800 billion times the mass of the Sun, a measurement also known as a solar mass.

It's pretty hard to measure the physical dimensions of our own galaxy from the inside, but astronomers have been able to calculate its mass - around 800 billion to 1.2 trillion solar masses, the researchers stated in their paper.

This finding puts the two galaxies, separated by a distance of about 2.5 million light-years, about on a par in terms of size.

Our galaxy and Andromeda are the two largest ones in what's known as the Local Group, a collection of more than 30 galaxies that spans roughly 10 million light-years.

"It completely transforms our understanding of the local group," Kafle said.

"We had thought there was one biggest galaxy and our own Milky Way was slightly smaller but that scenario has now completely changed."

The new measurement was obtained by a technique that calculates the speed required to escape the gravitational pull of a galaxy, or escape velocity.

"When a rocket is launched into space, it is thrown out with a speed of 11km/s to overcome the Earth's gravitational pull," Kafle explained.

"Our home galaxy, the Milky Way, is over a trillion times heavier than our tiny planet Earth, so to escape its gravitational pull we have to launch with a speed of 550km/s."

The team used the movement of high-velocity planetary nebulae within the Andromeda galaxy to calculate the galaxy's escape velocity, and arrived at a speed of around 470 ± 40 kilometres per second.

Kafle used a similar technique to determine the mass of the Milky Way in 2014. He also found that the Milky Way contained less dark matter than previously thought - a result which he has also found for Andromeda with his new research.

"By examining the orbits of high speed stars, we discovered that this galaxy has far less dark matter than previously thought, and only a third of that uncovered in previous observations," he said.

The result means that we may need new simulations to figure out what might happen when the two galaxies inevitably merge.

But it also means that we have a new way of collecting data about our universe.

"It's really exciting that we've been able to come up with a new method and suddenly 50 years of collective understanding of the local group has been turned on its head," Kafle said.

The study is due to be published in the Monthly Notices of the Royal Astronomical Society, and the arXiv pre-print can be found here.