On the night of July 5, a small spacecraft the size of a fridge aimed a laser at a speeding rock millions of kilometers from Earth — and hit it not once, but twice. Japan's Hayabusa2 probe just pulled off the first-ever laser-ranging experiment with an asteroid, a world first that will help us measure these drifting space rocks and better predict which ones might someday threaten our planet.

The target was Torifune, a near-Earth asteroid and the first exploration goal of Hayabusa2's Extended Mission. Near-Earth asteroids are space rocks whose paths bring them relatively close to our planet, and JAXA, Japan's space agency, wanted to prove a pair of things: that probes can fire lasers at small, fast-moving targets, and that those beams can reveal secrets about the rocks themselves.

Here is what made it so hard. Hayabusa2 was rocketing along at 5.3 kilometers per second — that's 18,000 kilometers per hour, or about 11,185 miles per hour. Aiming a narrow beam at a tiny asteroid from that kind of speed is like hitting a bullseye while sprinting. The laser, part of an instrument called LALT (built from the LIDAR Altimeter that JAXA's Kaguya lunar orbiter once used), fired twice. The first shot came 56.5 seconds before the flyby, from about 20 kilometers away, and the second 57.5 seconds out, from 15 kilometers. The beam's focus was so tight it lit up only a small patch of Torifune's surface — an area of about 30 meters, then 23 meters, roughly the size of a tennis court.

The team had to plan for every detail. They had to steer the probe with extreme precision, keep the instruments from picking up background noise, and account for the fact that in empty space there are no landmarks to line things up. Yet their preparations paid off, twice.

Why does this matter beyond being a cool trick? In space, there are no reference objects, so it's hard for a camera to tell what's foreground and what's background. Laser ranging adds a sense of scale, helping scientists measure an asteroid's true size. When the results are combined with tracking data over time, they can pin down an object's exact position and orbit far more accurately.

That accuracy has a serious job in what's called planetary defense — the effort to spot asteroids that might someday collide with Earth and figure out which ones are worth worrying about. This successful test proves that spacecraft can gather vital data on distant rocks even while racing past at high speed, which will help JAXA and other space agencies on future near-Earth asteroid missions.

The team is now crunching the numbers to find exactly where the laser struck Torifune's surface. For a probe already famous for its work around the asteroid Ryugu — where it collected samples and mapped the surface — this summer's laser trick adds another bright line to its record, and a useful tool to humanity's early-warning system for the skies.