PORTLAND, Ore. — Lynn Williams scored twice in overtime and the Western New York Flash beat the Portland Thorns 4-3 on Sunday for a spot in the National Women’s Soccer League championship game.

The Flash will play the Washington Spirit for the league title next Sunday in Houston. The Spirit beat the Chicago Red Stars 2-1 in overtime in the other semifinal Friday night.

“We talked about an opportunity to write a great story,” Flash coach Paul Riley said. “And this is a great story of a young team. Everyone had us in the ninth place of 10th place at the start of the season.”

Emily Sonnett scored the equalizer for the Thorns in the 78th minute. The Flash led 2-1 at the half after goals from Samantha Mewis and Makenzy Doniak. Christine Sinclair’s goal narrowed it for Portland in the 115th minute.

Williams, who won the league’s Golden Boot award for most goals in the regular season, scored in the 98th and 103rd minutes after a 2-2 draw in regulation. Lindsey Horan added a goal for the Thorns in the 115th minute to narrow the gap but Portland couldn’t catch up in front of a home crowd of 20,086 fans.

Riley, who was the Thorns’ coach in 2014 and 2015, was ejected in the 40th minute after an interaction with the referees.

After a goal in the 16th minute from Flash midfielder Mewis, an alternate for the U.S national team, and another from Doniak in the 38th, Portland found themselves in a 2-0 hole.

But less than a minute after Doniak’s goal, Sinclair put the Thorns on the board and celebrated with an authoritative first pump.

Sonnett’s equalizer in the 78th minute brought life back to the crowd and sparked some momentum from Portland, which won the inaugural championship in 2013.

Post-game, Thorns head coach Mark Parsons said that the loss is still sinking in but in about three hours, after having had a cup of tea, he will sit down and start watching the game tape and identify what the team needs to work on in the off season.

“I think when (the loss) sinks in, we have to continue what we’ve done,” Parsons said. “We attack each day with everything we’ve got to make sure we support these players and support this club to continue to move forward.”

Riley chose not to comment on the ejection after the game and does not know whether or not he will be allowed to coach the Flash during the championship game.

“The standard of coming in here and winning it here is unbelievable,” Flash coach Paul Riley said. “The fact is that (the Thorns) are that good, I mean that midfield is top-notch. And it’s important that Portland does well. I think for our league it’s important that Portland does well. I would vote to give them a home game every year. Just give it to them. I think it’s fantastic for our team to come here and get this experience.”

The Thorns finished out the regular season with a four-game winning streak and claimed the NWSL Shield for the team with the best record. They also clinched home-field advantage in the playoffs for the first time.

Portland is the third team in league history to allow an average of less than one goal per game over the course of the regular season and the Flash are just the third team to average at least two goals a game.

Sinclair won the bronze medal at the Olympic with the Canadian national team. The Thorns’ loaded roster also included U.S. Olympians Tobin Heath, Lindsey Horan, Meghan Klingenberg, Allie Long and alternation Emily Sonnett. Amandine Henry played for France in Brazil.

“We clawed back but dug ourselves a little bit too big of a hole in extra time,” Sinclair said. “It’s tough. Everywhere else in the world with soccer if you win the league you win the league. Whereas I think it’s unique in North America where playoffs are the big thing and it makes it interesting. Soccer is a funny game. Anyone can give anyone on any given day and you saw that today.”