The United States was seconds away from defeating Portugal on Sunday when Michael Bradley, normally one of the steadiest American players, mishandled a ball in midfield and gave Portugal a last opportunity. Silvestre Varela took advantage, scoring on a header.

But the 2-2 draw was a result the U.S. might have been happy with before the match began. It improved the Americans’ odds of advancing to the knockout round of the World Cup. Those chances are up to 76 percent, according to the FiveThirtyEight forecast, an improvement from 65 percent before Sunday’s match.

That 76 percent figure may even be slightly low, for reasons I’ll explain in a moment. Still, the U.S. will not be guaranteed advancement unless it manages at least a draw against Germany on Thursday in Recife, Brazil. If the U.S. loses, the Portugal-Ghana game, which will kick off simultaneously in Brasilia, could cause heartbreak for Americans. You may want to have two screens at your disposal for Thursday’s matches.

The U.S. has essentially three ways to advance to the knockout stage:

The easy way. First, it could draw or beat Germany. That might not sound so challenging, but the Germans are the third-best team in the world, according to ESPN’s Soccer Power Index. Our forecast gives the U.S. a 14 percent chance of a win and a 22 percent chance of a draw — but a 64 percent chance of a loss. As a bonus, however, the U.S. will advance first from Group G if it beats Germany. That matters because the first-place team from Group G is likely to face Russia or Algeria in the Round of 16 — while the second-place team will face a stronger side in Belgium.

First, it could draw or beat Germany. That might not sound so challenging, but the Germans are the third-best team in the world, according to ESPN’s Soccer Power Index. Our forecast gives the U.S. a 14 percent chance of a win and a 22 percent chance of a draw — but a 64 percent chance of a loss. As a bonus, however, the U.S. will advance first from Group G if it beats Germany. That matters because the first-place team from Group G is likely to face Russia or Algeria in the Round of 16 — while the second-place team will face a stronger side in Belgium. The almost-as-easy way. Next, the United States could lose to Germany but advance if Ghana and Portugal draw in Brasilia. Our forecast puts the chance of a Ghana-Portugal draw at 29 percent.

Next, the United States could lose to Germany but advance if Ghana and Portugal draw in Brasilia. Our forecast puts the chance of a Ghana-Portugal draw at 29 percent. The hard way. Finally, the U.S. could lose to Germany but advance because it edges either Portugal or Ghana — whichever team wins in Brasilia — on goal differential or another of FIFA’s tiebreakers.

Let’s talk tiebreakers. FIFA resolves ties in the group stage in the following order: goal differential, goals scored, head-to-head results. (Eventually, it gets down to drawing lots.)

So far, the United States has four goals scored and three allowed — a +1 differential. Ghana has scored three times but allowed four goals — a -1 differential. Portugal has scored twice but allowed six goals, giving them a -4.

That seems favorable for the U.S. But we’re specifically concerned about the scenario where the United States loses Thursday and there’s a victor in Brasilia. In that case, the goal differential will tighten.

For example, if the U.S. loses to Germany 1-0 but Ghana beats Portugal 1-0, then the U.S. and Ghana would have an even goal differential. They’d also each have four goals scored and four goals allowed. So advancement would come down to the third tiebreaker — head-to-head results — and the U.S. would advance only on account of having beaten Ghana.

But Ghana could advance under other scenarios. If the U.S. loses to Germany by more than one goal — not unlikely against a formidable German offense — or Ghana’s win against Portugal is by more than one goal, then Ghana will go forward.

Ghana would also advance if both games are decided by one goal but Ghana’s is higher scoring. For instance, if Ghana beats Portugal 2-1 but the U.S. loses to Germany 1-0, then Ghana would advance on the basis of the goals-scored tiebreaker by having scored five goals throughout the group stage to the United States’ four.

The U.S. has less to worry about if Portugal wins in Brasilia. But it’s not out of the question that the Portuguese could advance. This would require a blowout win by Portugal, a blowout loss by the U.S. or some combination thereof. For example, if the U.S. lost to Germany 3-0 and Portugal beat Ghana 3-1, then Portugal would advance.

So, why I do I say that our 76 percent figure might slightly underestimate the Americans’ chances? One reason is technical rather than soccer-related: Our simulation was programmed to resolve ties beyond goals scored and goal differential randomly, rather than looking at head-to-head results, because the head-to-head tiebreaker so rarely comes into play. But if a Ghanaian win in Brasilia and an American loss in Recife come by exactly the same scoreline — e.g. Ghana 3, Portugal 2, and Germany 3, U.S. 2 — that would trigger the head-to-head tiebreaker. The probability of such an outcome is low, but it means the simulator has slightly underestimated the U.S.’s advancement prospects, perhaps by 1 or 2 percent.

The other reason is that four teams in Group G know this math just as well as you or I do — and that could affect the style of play in both Recife and Brasilia. Germany has no real incentive to beat the United States — it also advances in first place from the group with a draw. A draw is also a good result for the U.S., getting it to the knockout stage. That could lead to a more conservative game plan for both teams and a slower pace, making the odds of a draw higher than they otherwise might be.

Of course, just the opposite is true for Ghana and Portugal. Both teams fail to advance with a draw. In fact, a mere one-goal win would be problematic for both teams and especially for Portugal. That means they’ll have every reason to play attacking football and pile on the goals until the last minute, making a draw less likely and a lopsided score more likely than it might be ordinarily.