In 1873, New Mexico Territory, an unnamed loner (Daniel Craig) wakes up in the desert injured, with no memory and with a strange metal object on his wrist. After killing three drifters who think he might be worth bounty money, he takes their clothes, weapons and a horse. 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), a volatile drunk who has been terrorizing the town, Sheriff Taggart (Keith Carradine) recognizes the stranger as Jake Lonergan, a wanted outlaw, and attempts to arrest him. Jake beats up the posse sent to take him in and nearly escapes, but a mysterious woman named Ella Swenson (Olivia Wilde) knocks him out. Taggart prepares to transport both Jake and Percy to Santa Fe for trial.
Percy's father, Colonel Woodrow Dolarhyde (Harrison Ford), a wealthy and ruthless cattleman, arrives with his men and demands that Percy be released. He sees Jake and also demands he be released to him, since Jake was the one who stole Dolarhyde's gold. During the standoff, multiple alien craft begin attacking the town. Percy, the sheriff and many other townsfolk are grabbed by long, whip-like feelers hanging from the bottom of the alien ships and are abducted. Jake's shackle unfolds and becomes a weapon. Jake shoots down one of the ships with a single shot, ending the attack.
Dolarhyde, Ella, and other townsfolk form a posse to track an injured alien that escaped from the downed ship. Jake, meanwhile, travels to an abandoned cabin, and in a flashback, recalls returning there with stolen gold, but just before a woman, Alice (Abigail Spencer), demands that he returns it, they are abducted by the aliens. His memories returning, Jake joins up with the posse. During the evening, they come upon an upside-down paddle wheel steamboat that the alien's apparently dumped miles from any water. They camp in it and during the night the alien they were tracking kills Meacham, who sacrifices himself to save Emmett (Noah Ringer), 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 captured. Jake jumps aboard the ship and attacks the alien pilot, causing the ship to crash, but Ella is fatally wounded.
Shortly after the crash, however, the posse is captured by Chiricahua Apache Indians, who blame them for the alien attacks. After Ella's body is dumped on a fire by a Chiricahua warrior, she is fully resurrected. Ella reveals herself to be an alien from "beyond the stars" who has traveled to Earth to help resist the invaders after they destroyed her home world. The aliens, who are mining gold and abducting humans to conduct experiments to find their weaknesses, are far stronger and more durable than humans, and have superior weaponry. But they are not invulnerable. They can be stabbed and shot to death, and Jake's gauntlet weapon can kill them with a single blast.
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 medicine offered by the Apaches, Jake recalls that Alice was euthanized after she was used in an alien experiment, but he escaped, inadvertently stealing a gauntlet-like alien weapon. He could also remember the location of the aliens' base of operations.
Armed with this knowledge, the group, now led by Dolarhyde, prepares to attack the aliens' grounded mother ship. Jake returns to his old gang and persuades them to join the fight. In a sneak attack, the humans breach the defenses of the spaceship by destroying the aircraft entrance, 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 responsible for Alice's death. As the remaining aliens are taking off in their damaged craft, Ella sacrifices herself, entering the ship's core and destroying it using Jake's wrist gauntlet.
Jake's memory partially returns, and some abducted townsfolk begin to remember their past. Still a wanted man, Jake decides to leave; the sheriff and Dolarhyde say they will claim that he was killed in the invasion. The citizens intend to rebuild the town with the expectation that the newly discovered gold mine will soon bring many new settlers. Jake kindly rejects Dolarhyde's offer to help rebuild the town, and rides away.