SAN JOSE — Julie Ertz, Alex Morgan and Carli Lloyd scored and the U.S. national team closed out play this year with a 3-1 victory over Canada at Avaya Stadium on Sunday night.

The two teams also faced each other Thursday at BC Place in Vancouver, British Columbia, playing to a 1-1 draw. The tie snapped a six-game winning streak for the top-ranked Americans.

Canada, which won the bronze medal at the 2016 Olympics, is ranked fifth in the world and considered a team on the rise. But the Canadians have not defeated the United States since 2001.

Ertz, who played in college at Santa Clara, scored her sixth goal of the year in the 11th minute on a header off a set piece. It was her 14th international goal and all of them have been the result of a set play.

Canadian captain Christine Sinclair came close to equalizing with a shot in the 32nd minute that was just wide of the far post. Sinclair, who plays for the NWSL's Portland Thorns, was slow to get up after the shot.

Janine Beckie scored her first goal against the United States in the 50th minute off a well-placed pass from Nichelle Prince. Both are teammates on the Houston Dash.

Some seven minutes later Morgan put the United States back on top, slotting home a goal that got past Canadian goalkeeper Stephanie Labbe. It was Morgan's 80th of the season. She leads the Americans this year with seven goals.

Lloyd, who came in as a sub in the second half, added a final goal in the 80th minute. Lloyd needs just two more goals for 100 in her career.

"Obviously, end of the year we wanted to finish it off on a good note, and I thought tonight was well played," U.S. coach Jill Ellis said.

Morgan scored for the United States and Adriana Leon had a goal for Canada in the first match of the series.

The two games were the last for the United States this year. Next year the Americans will prepare for qualifying to defend their World Cup title in 2019.

The United States was without midfielder Tobin Heath, who was called into training for the matches but didn't play because of a nagging ankle injury. Mallory Pugh, Rose Lavelle and Morgan Brian didn't train with the team for the final matches because of hamstring injuries.