SAN FRANCISCO, 1 May 2015 (AFP) - Northern Irishman McIlroy seemed to be following Spieth out of the $9.25 million tournament at Harding Park after finding himself two down with two holes to play against Horschel in the Group 1 decider.
But a magnificent long birdie putt on the must-win 17th ignited a late charge from McIlroy who then won the 18th before prevailing on the second hole of sudden death.
McIlroy said he had drawn inspiration for his crucial birdie putt on the 17th from a similar situation at last year's Ryder Cup.
"I remembered I holed a putt I think on the 17th at the Ryder Cup last year when I was playing with Sergio (Garcia) and it was same sort of thing where I knew I had to hole it or I was going to get beaten," said McIlroy.
"So I drew a bit of inspiration from that and hit the best putt I made all day. When we got to 18 I knew I just had to keep the pressure on him and somehow I was able to turn it around."
McIlroy will now face Hideki Matsuyama in the last 16 on Saturday and believes the Japanese 16th seed will need to produce something special.
"I haven't made that many birdies but I think over the last few days I've made only one bogey," he said. "So if guys want to beat me they're going to have make birdies."
Fans hoping to see McIlroy face off with Masters champion Spieth over the weekend were left disappointed however after the 21-year-old US prodigy lost in a tight duel to England's Lee Westwood.
European Ryder Cup star Westwood recovered from losing the opening two holes to go one up after draining a 10-foot birdie putt on the 17th.
Spieth was unable to wrest back the initiative on the 18th, giving Westwood a two-up victory and allowing the 42-year-old English veteran to advance.
"Today I had nothing to lose," a delighted Westwood said. "Jordan is arguably the best player in the world at the moment so it was nice to be the underdog for a change."
"I'm pleased with the way I got through it coming down the stretch," he said.
Spieth was philosophical in defeat, saying he was satisfied with his form despite the loss.
"I just had a tough opponent," he said. "I've no complaints -- I was 16 under in three rounds. But it's Match Play, so what are you going to do?
"I'm excited about the way I'm playing, it's just a shame it ended like that today."
Both Westwood and Spieth had won their opening round-robin games to set up a winner-takes-all scenario in their final Group 2 game.
The match hinged on a dramatic recovery from Westwood on the 16th when he appeared to have gifted Spieth the lead.
After landing a tee-shot in the bunker, Westwood mishit his recovery through the back of the green. A disastrous third shot then landed in the rough just off the green, leaving Spieth poised to go one up.
But Westwood conjured a superb chip-in to halve the hole and then took the lead on the par-three 17th when Spieth's tee shot landed well wide of the pin.
In other matches Friday, South Africa's Louis Oosthuizen exacted a measure of revenge over American fourth seed Bubba Watson to send the two-time Masters champion packing.
Oosthuizen, who lost to Watson in a sudden-death playoff in the 2012 Masters, booked his place in the last 16 with victory on the 19th hole after the decisive match in Group 4 finished all square after 18.
Second round scores from WGC-Championship Match Play here Friday (USA unless stated):
Group 1
Rory McIlroy (NIR) bt Billy Horschel 20 holes
Jason Dufner bt Brandt Snedeker 1 up
Group 2
Lee Westwood (ENG) bt Jordan Spieth 2 up
Mikko Ilonen (FIN) bt Matt Every 8&6
Group 3
John Senden (AUS) bt Brendon Todd 1 up
Bill Haas bt Henrik Stenson (SWE) 3&1
Group 4
Louis Oosthuizen (RSA) bt Bubba Watson 19 holes
Miguel Angel Jimenez (ESP) bt Keegan Bradley 2 up
Group 5
George Coetzee (RSA) bt Thongchai Jaidee (THA) 21 holes
Jim Furyk bt Martin Kaymer (GER) 20 holes
Group 6
Mark Leishman (AUS) bt Anirban Lahiri (IND) 1 up
Justin Rose (ENG) bt Ryan Palmer 2&1
Group 7
Branden Grace (RSA) bt Charley Hoffman 2&1
Zach Johnson bt Jason Day (AUS) 3&2
Group 8
Charl Schwartzel (RSA) bt Matt Jones (AUS) 20 holes
Dustin Johnson bt Victor Dubuisson (FRA) 2&1
Group 9
Paul Casey (ENG) bt Francesco Molinari (ITA) 1 up
Chris Kirk bt Adam Scott (AUS) 1 up
Group 10
Jamie Donaldson (WAL) bt Sergio Garcia (ESP) 2&1
Tommy Fleetwood (ENG) bt Bernd Wiesberger (AUT) 19 holes
Group 11
Gary Woodland bt Webb Simpson 1 up
Ian Poulter (ENG) bt Jimmy Walker 4&2
Group 12
JB Holmes bt Brooks Koepka 2&1
Russell Henley bt Marc Warren (SCO) 1 up
Group 13
Rickie Fowler bt Graeme McDowell (NIR) 5&4
Harris English bt Shane Lowry (IRL) 1 up
Group 14
Hunter Mahan bt Matt Kuchar 5&4
Ben Martin bt Stephen Gallacher (SCO) 20 holes
Group 15
Danny Willett (ENG) bt Andy Sullivan (ENG) 1 up
Patrick Reed bt Ryan Moore 1 up
Group 16
Hideki Matsuyama (JPN) bt Kevin Na 5&4
Joost Luiten (NED) bt Alexander Levy (FRA) 1 up