Justice Anthony Kennedy, who wrote the majority opinion, said a lower court used too restrictive a standard when deciding whether Scott Louis Panetti's mental illness prevented him from understanding why he was to be executed.
Panetti killed his estranged wife's parents in front of his wife and daughter in 1992, Kennedy's decision said.
A dissent by Justice Clarence Thomas said Panetti is "competent to face the consequences of the two murders he committed."
The court's 5-4 ruling overturned a lower court that had allowed the execution and came on the final day of the Supreme Court's current term.
Justin Bieber crashes Drake Bell's album release party
Members of Congress to keep receiving porn magazine