Taulia Tagovailoa threw for 419 yards and two touchdowns, and Maryland snapped its three-game losing streak with a 38-35 victory over Indiana on Saturday.

The Terrapins (5-3, 2-3 Big Ten) trailed 17-14 after a 66-yard touchdown run by Indiana's Stephen Carr in the third, but Maryland answered with two touchdown drives before the quarter was over.

Challen Faamatau put the Terps ahead with a 1-yard scoring run, and then Tagovailoa connected with Carlos Carriere for a 14-yard touchdown that made it 28-17.

Tagovailoa's second TD pass came in the final quarter on a 45-yard catch-and-run by Carriere. Then Donaven McCulley threw an 18-yard touchdown pass to Peyton Hendershot for the Hoosiers (2-6, 0-5), and a 2-point conversion made it 35-28.

CLICK HERE FOR MORE SPORTS COVERAGE ON FOXNEWS.COM

Joseph Petrino made a 41-yard field goal with 1:20 remaining to make it a 10-point game. McCulley's 8-yard touchdown pass to Hendershot made it 38-35 with 1:00 to play, but Maryland recovered the ensuing onside kick.

Tagovailoa and the Terrapins won their first four games this season before blowout losses to Iowa and Ohio State and a road defeat against Minnesota. They got back on track in their homecoming game against the struggling Hoosiers.

Maryland scored touchdowns on its first two drives, on 1-yard runs by Tayon Fleet-Davis and Faamatau. Joseph Petrino missed a 40-yard kick that would have made it 17-0, and Indiana drove the other way and scored on a 1-yard run by Carr.

The game bogged down a bit after that. Indiana blocked a punt and took over at the Maryland 13, but came away with no points. A sack and a penalty forced the Hoosiers to try a 42-yard field goal, which Charles Campbell missed.

Campbell made up for that when he made a 55-yarder in the final seconds of the half to make it 14-10.

The long run by Carr gave Indiana its first lead of the game, but it was brief. With Michael Penix Jr. and Jack Tuttle injured, McCulley played quarterback for the Hoosiers. The freshman was 14 of 25 for 242 yards and two TDs.

THE TAKEAWAY

Indiana: The Hoosiers are still winless in the Big Ten, a remarkable disappointment for a team that began the season in the Top 25. Indiana's previous five losses were against teams that have been in the top 10 at some point, but this game showed just how far the Hoosiers have fallen.

Maryland: This was a big win for the Terps as they attempt to reach the six-win mark that would assure bowl eligibility. Maryland's next three games are against Penn State, Michigan State and Michigan. The Terrapins then face Rutgers in the regular-season finale.

UP NEXT

Indiana: The Hoosiers play at No. 6 Michigan next Saturday.

Maryland: The Terrapins host No. 20 Penn State on Saturday.