Rosol battled Korolev, who had replaced Kazakh number one Mikhail Kukushkin for the first reverse singles, for more than three-and-a-half hours before sealing the quarter-final tie, played on clay at the National Indoor Tennis Centre in Astana.
The Czechs had built up a 2-0 lead after winning both of their singles matches on Friday but the home team avoided an early exit by taking Saturday's doubles.
The visitors were missing their top player, world number six Tomas Berdych, who pulled out of the tie after injuring his shoulder at last week's Sony Open in Miami.
Kazakhstan shocked the Czechs 3-2 in their only previous Davis Cup encounter in Ostrava in 2011 when they made their debut in the World Group as an independent nation, but could not repeat their heroics this time.
The Central Asian country, whose entire line-up is made up of Russian-born players, put their faith in 187th-ranked Korolev for the crucial fourth rubber.
Moscow-born Korolev, a cousin of former Russian number one Anna Kournikova, fought tooth and nail against his more experienced opponent for three sets before running out of steam.
After snatching the third set in a tie-breaker 7-5, Rosol broke a tired-looking Korolev twice in the fourth to clinch the match and the tie.
"I'm very proud of Lukas because it was one of the toughest matches for him as he does not have too many chances to play matches like this. He was the leader of this team this week," Czech captain Jaroslav Navratil told the Davis Cup website (www.daviscup.com).
Rosol, who beat Kazakh number two Andrey Golubev on Friday, added: "It's a great feeling to win two matches for your country in Davis Cup in one weekend. Tomas Berdych had it last year and now I also know a little bit of this feeling."
Berdych led the Czechs to their first Davis Cup title as an independent nation last year.
In September's semi-finals, the Czechs face Argentina or France. Argentina led their quarter-final 2-1 going into the final day in Buenos Aires on Sunday.
- Sports & Recreation
- Tomas Berdych