The crew on Oracle Team USA celebrates after crossing the finish line during the 18th race of the America’s Cup sailing event against Emirates Team New Zealand, Tuesday in San Francisco. Oracle Team USA won races 17 and 18 to pull even with Emirates Team New Zealand. At left is skipper Jimmy Spithill.

SAN FRANCISCO — The longest America’s Cup in history will come down to two 72-foot, space-age catamarans making a final, dramatic sprint around San Francisco Bay, on a five-leg course framed by the Golden Gate Bridge and Alcatraz Island.

Skipper Jimmy Spithill and defending champion Oracle Team USA saw to that by extending their almost unimaginable winning streak to seven on Tuesday to force a winner-take-all finale against Emirates Team New Zealand.

Oracle came through a wild start with two collisions to win Race 17, and then sped past the Kiwis after they made a tactical error to give up the lead in Race 18 in strong wind.

All but defeated a week ago, Oracle Team USA tied the faltering Kiwis 8-8 on the scoreboard by winning its 10th race overall.

Oracle was docked two points for illegally modifying boats in warmup regattas and Dirk de Ridder, who trimmed the 131-foot wing sail, was disqualified.

If it hadn’t been hit with the harshest penalties in the 162-year history of the America’s Cup, Oracle Team USA’s sailors would be hoisting the oldest trophy in international sports in victory and spraying each other with champagne.

Instead, the epic 19th race is scheduled for Wednesday, weather-permitting, on San Francisco Bay.

Either Oracle will finish one of the greatest comebacks in sports history or Team New Zealand, marooned on match point for the past week, will get the win it needs to claim the Auld Mug for the second time in 18 years and ease the nerves of the 4.5 million residents of the island nation.

Oracle has gotten faster as it’s made changes to its black cat every night in its big boatshed on Pier 80 and has steadily learned to sail it better under the watchful eye of team CEO Russell Coutts, a four-time America’s Cup winner.

But there’s a bigger reason Oracle is still alive.

“Never giving up,” Spithill said.

The 34-year-old Australian has been almost defiant in leading his well-funded, deep team after it was penalized just four days before the sailing began.

“I really feel it’s because we’ve been through such hard times in this campaign that it’s prepared us for this situation,” Spithill said. “I spoke yesterday a lot about the capsize and stuff like that and what went on before this regatta. This team has just been through so much and some incredibly difficult times. Those were key moments, we needed those key moments to prepare us as a team.”

Oracle’s first boat capsized in October and its wing sail was destroyed, costing the team four months of training time until a new one arrived from New Zealand.

Barker, the losing skipper in the 2003 and 2007 America’s Cup, looked deflated after the double losses.

“We got beaten today, and that’s tough to handle, but sometimes you just have to accept that,” he said. “It’s frustrating, but we know we can still win this, and we will go out there and give it absolutely everything we can tomorrow.”

Spithill may very well have gotten into the heads of Barker and the Kiwi crew on Sept. 12. With Oracle trailing 6 to minus-1, he said: “I think the question is, imagine if these guys lost from here, what an upset that would be. They’ve almost got it in the bag. That’s my motivation.”

On Tuesday, Spithill said: “It’s not over. That’s the key point here is, we’ve got to finish it off.”

In terms of drama, this America’s Cup rivals the 1983 regatta, when Australia II rallied from a 3-1 deficit to beat Dennis Conner in seven races to end the New York Yacht Club’s 132-year winning streak.

Tuesday’s races were so pivotal that software billionaire Larry Ellison, who owns Oracle Team USA, skipped making a keynote speech before 60,000 people at Oracle Open World so he could witness the comeback firsthand from a chase boat on the bay.

Barker dominated Spithill at the start of Race 18 and beat him to the first mark with his 72-foot catamaran, allowing the Kiwis to control the race.

The Kiwis led by 7 seconds rounding the second gate mark before committing the blunder that cost them the lead and, perhaps, the America’s Cup.

Team New Zealand tacked too early heading into the first cross going upwind and slowed dramatically as the boats zigzagged toward the Golden Gate Bridge on the only windward leg on the course.

The American-backed boat — with only one American on its 11-man crew — went speeding past and built its lead to more than 1,000 yards on the windward fourth leg going past Alcatraz Island.

The final margin was 54 seconds. Spithill did a flyby of Pier 27-29, with his crew lining the port hull to wave and pump their fists toward the crowd.

Oracle, which trailed 8-1 last Wednesday, has dramatically increased its speed sailing upwind after struggling repeatedly against the Kiwis earlier in the regatta. As it overhauled the Kiwis in Race 18, Oracle’s hulls were out of the water, riding on hydrofoils.

“I think it’s fairly clear to see that we could have tacked pretty much anywhere and we would have been behind at the end of that leg,” Barker said. “They were going pretty damn well. This was the first time that we’ve recognized that there was a condition where we’re maybe not as strong as we need to be. It’s tough because you’re doing everything you can. The guys never gave up, but clearly the Oracle guys were going pretty well in that stuff.”

Earlier, Oracle forced Emirates Team New Zealand into two penalties during the wild start of Race 17 and won by 27 seconds.

Spithill appeared in trouble just before the start but hooked behind Barker into a favored leeward position as the boats jockeyed just inside the Golden Gate Bridge.

The 72-foot catamarans touched, and Oracle tactician Ben Ainslie yelled at the Kiwis to tack away. They collided again, this time harder, with Ainslie gesturing angrily.

Team New Zealand sat dead in the water to clear the penalties as Oracle pulled away — and stayed ahead the whole way around the course.

Spithill and his mates are the first to win seven straight races in an America’s Cup match. There have been three five-race winning streaks when the Cup was best-of-9. This regatta started as best-of-17, but Oracle will need to win 11 races to keep the Cup.

Oracle has twice trailed by seven points, most recently when Team New Zealand won Race 11 on Wednesday for an 8-1 lead.

After Oracle won Race 12, Team New Zealand was denied the chance to seize the Cup when Race 13 was abandoned because of a 40-minute time limit with the Kiwis well ahead in light wind.

When the race was resailed in a better breeze, Oracle won to begin its winning streak.

With the two victories Tuesday, Oracle Team USA has won for the ninth time in 13 races since Ainslie, a British Olympic star, replaced American John Kostecki as tactician.

Ainslie has teamed with Australian strategist Tom Slingsby, also an Olympic gold medalist, to help guide Spithill around the course.

It’s been an agonizing week for New Zealanders, who’ve been getting up early to watch the races on TV.

At the Royal Port Nicholson Yacht Club in Wellington, Kate Robinson said that she had been rooting for Spithill a week ago as Oracle struggled.

“I wanted him to do better,” she said. “But not this well.”

And if Team New Zealand loses?

“I’ll probably cry,” she said. And she wasn’t joking.

———

Associated Press Writer Nick Perry in Wellington, New Zealand, contributed to this report.