In 1873, Arizona Territory, an unnamed loner (Daniel Craig) awakens in the desert injured, with no memory, and a strange metal band shackled to his wrist. He wanders into the small town of Absolution, where the local preacher, Meacham (Clancy Brown), treats his wound. After the stranger subdues Percy Dolarhyde (Paul Dano), who has been terrorizing the populace, Sheriff Taggart (Keith Carradine) recognizes him as Jake Lonergan, a wanted outlaw, and tries to arrest him. Jake nearly escapes, but a mysterious woman named Ella Swenson (Olivia Wilde) knocks him out.
Percy's father, Colonel Woodrow Dolarhyde (Harrison Ford), a rich and influential cattleman, arrives with his men and demands that Percy be released to him. He also wants Jake, who stole Dolarhyde's gold. During the standoff, alien spaceships begin attacking the town, and Percy, the sheriff, and many townsfolk are abducted. Jake shoots down one ship with a device concealed in his wrist band, ending the attack.
Dolarhyde, Ella, and some townsfolk form a posse to track an alien that may have ejected from the downed ship. Jake, meanwhile, travels to an abandoned cabin, and in a flashback, recalls returning there with the gold just before he and a woman, Alice, were abducted by the aliens. Jake returns to join the posse. During the night, the alien they were tracking appears and kills Meacham, who sacrifices himself to save Emmett, Taggart's grandson.
By the next morning, most of the posse has deserted, and the others are attacked by Jake's former gang. Jake, who stole the gang's loot after their last heist, attempts to retake control, but fails. As he and the others flee, the aliens begin attacking again and Ella is seized. Jake jumps aboard the ship and attacks the alien pilot, causing the ship to crash, but Ella is mortally wounded.
Chiricahua Apaches capture the posse, blaming them for the alien attacks. As Ella's body is dumped on a fire, she is fully resurrected. Ella is actually an alien who traveled to Earth to help humans resist the invaders after they destroyed her homeworld. The aliens, who have been abducting humans to perform experiments on, are also mining gold to power their machines. They are not invulnerable, however: Jake's gauntlet weapon can kill them, as well as stabbing and shooting, though the creatures are far stronger and more durable than humans and have superior weapons. Ella claims Jake holds the secret to the aliens' whereabouts and says they must stop them before they exterminate all life on the planet. After taking Mescaline offered by the Indians, Jake recalls that Alice died in an alien experiment, but he escaped, inadvertently stealing the alien weapon. He can also remember the aliens' hidden location.
Armed with this knowledge, the group, now led by Colonel Dolarhyde, prepares to attack the aliens' grounded mothership. Jake returns to his old gang and persuades them to join the fight. In a sneak attack, the humans breach the spaceship, forcing the aliens into a ground battle. Jake and Ella board the ship and free the captives, but Jake is captured. Dolarhyde rescues him and both men escape the ship after killing the alien leader. As the remaining aliens are taking off in their damaged craft, Ella sacrifices herself, destroying the ship using Jake's gauntlet.
Jake's memory partially returns, and some abducted townsfolk can recall their past. Still a wanted man, Jake decides to leave; the sheriff and Dolarhyde say they will claim that he was killed. The citizens intend to rebuild the town with the expectation that the newly discovered gold mine will soon bring many new settlers.