World number one Lleyton Hewitt earned a psychological boost before next week's French Open by breaking a four-match losing streak against Carlos Moya at the World Team Cup on Thursday.
The Australian matched Moya from the baseline to claim a 6-2 3-6 6-3 victory and put his team ahead of Spain in the Red Group.
But his joy was short-lived as Alex Corretja beat Wayne Arthurs to level the scores before Spain won the deciding doubles to clinch a 2-1 victory.
Spain's first win this week was too late to prevent them going out of the tournament, as the Czech Republic reached Saturday's final by coming from behind to beat the US 2-1 and top the Red Group with three wins and no defeats.
The Czechs will now face either Argentina or Chile, who meet on Friday to decide the winners of the Blue Group.
Hewitt was delighted after claiming his third singles win of the week. "It's a nice little confidence boost for me," he said.
"I feel like it was probably one of my best matches on clay and to know you can match it with these guys just a few days before the French is a good feeling."
Hewitt took full advantage of a sluggish Moya to wrap up the first set in 32 minutes.
But Moya, who had won their last four meetings in straight sets, woke up and won the second set to level the match.
Hewitt broke for 2-1 in the decider, but two games later a sloppy forehand cost him the lead and Moya was back on terms at 3-3. Moya then dropped his serve to 15, double-faulting to hand Hewitt the advantage again.
This time the Australian held serve for 5-3 and clinched victory with a rasping forehand pass down the line.
"I took it to him, really tried to be aggressive, to play my game and not let Carlos dictate the points," said Hewitt.
His compatriot Arthurs let slip a one-set lead as he was beaten 3-6 7-5 7-5 by a resurgent Corretja, who won his second singles match of the tournament.
Spain completed their first overall victory of the week when Corretja and Fernando Vicente teamed up to beat Mark Philippoussis and Todd Reid 6-1 6-1.
In the day's other match, James Blake put the US 1-0 up against the Czech Republic with his first singles win of the week. The American recovered from a break down in the deciding set to beat world number 14 Jiri Novak 7-5 4-6 6-3.
"To know I can effectively play with these top 10 guys is a good feeling," Blake said. "I had lost five matches in a row and I was in a bit of a rut, but today I found that happy medium for a while."
Radek Stepanek restored parity for the Czechs with a 6-2 7-5 win over Todd Martin in the second singles and Stepanek and Novak edged Blake and Mardy Fish 6-3 4-6 6-1 to clinch their place in Saturday's final.