Stepanek outlasted the 11th-ranked Almagro 6-4, 7-6 (7-0), 3-6, 6-3 in the fifth and deciding match of the international tournament, giving the Czech Republic its first Davis Cup win since 1980, when the country was known as Czechoslovakia.
Stepanek's victory ignited a wild celebration at Prague's O2 Arena, which hosted the 100th Davis Cup final.
"I've been dreaming of this my whole life," Stepanek said. "We've written history today here in our country."
His victory came after Spain's David Ferrer downed Tomas Berdych 6-2, 6-3, 7-5 in Sunday's first reverse singles match to force the deciding match.
Notable deaths of 2014 [PHOTOS]