Arthur C. Clarke once said that "any sufficiently advanced technology is indistinguishable from magic." Perhaps that's how Thor's hammer seems to many who've read about it in Marvel Comics or seen it in The Avengers and Thor films: it's a magical object that only Thor can wield.
However, Thor comes from an advanced race of people that live on a planet called Asgard. It's likely that Asgardians have this kind of superior technology, including the concepts that gives the hammer, also known as Mjölnir, its unique properties.
However, an engineer on Earth, Allen Pan, just figured out how to create a real version of Mjölnir that works: by using electromagnetics and fingerprint scanning, he created a working version of Thor's hammer that allows only him to pick it up.
To keep the hammer from being easily moved, Pan put microwave oven transformer electromagnets inside its head. This kind of electromagnet creates a magnetic field via electricity, which holds the hammer firmly in place when set upon a metal surface. This makes the hammer seem heavier than it really is when anyone tries to move it and makes it immovable.
The hammer's handle has a touch sensor connected to an Arduino Pro Mini and a solid state relay: this acts as a switch that turns on the electromagnets in the hammer's head when anyone touches the handle. However, there's an exception: Pan can move the hammer because there's also a fingerprint sensor embedded into the handle: the hammer's programming recognizes Pan as "the worthy" when he touches it, which turns off the electromagnets, allowing only him to pick it up.
So, it may seem like magic, but it's just really technology.
In a YouTube video, Pan set his version of Mjölnir on a metal manhole cover and challenged innocent passersby to attempt to lift it. The results are pretty funny (almost as funny as when the Avengers tried the same thing).
Of course, Pan's version of Thor's hammer can't do a lot of things that it does in the comics: it definitely doesn't come flying through the air when summoned and it can't destroy mountains (although it could probably crush some heads).
Whatever the case, though, Pan managed to take inspiration from comic books and movies and create something that could eventually lead to better technology for preventing certain kinds of theft. That would even impress Tony Stark.