It was all there for Maryland's taking Saturday: a prime opportunity against a struggling, turnover-prone rival to go 2-0 in the Atlantic Coast Conference for the first time since 2001 and to begin to make something of a season from which little was expected.

Maryland started quickly — a 100-yard kickoff return for a touchdown by Stefon Diggs — and its defense held on to record a 27-20 victory and spoil the Cavaliers' homecoming on a sunny day in front of an announced 45,556.

“We've got a happy locker room next door,” Maryland coach Randy Edsall said. The Terps (4-2, 2-0 ACC) could be heard singing the Maryland fight song and counting out the number of wins: “1, 2, 3, 4.”

If the singing and clapping — which could be heard through a cinderblock wall — continued longer than usual, that's because the veteran players remembered all those Saturdays last season when the Terps lost these sorts of close games in the fourth quarter. They spent much of training camp focusing on how to close out games.

“People were just overjoyed,” said linebacker Demetrius Hartsfield, who helped lead a defense that recorded five sacks and held two Virginia quarterbacks to 18-for-39 passing.

“It's our second ACC win,” Hartsfield added. “We haven't won two ACC games in two years. And I think it was just a lot of emotion put into that game. [It was] a rivalry game also, and it being their homecoming, there was just so much put on the table.”

It was Maryland's first ACC road win since November 2010 — which also came at Virginia. With the victory, Maryland is the only team remaining unbeaten in conference play. The Terps had an early bye week and have played fewer conference games than the other teams.

Trailing 27-20, Virginia got the ball on Maryland's 49 after a punt with 1:51 left. Quarterback Michael Rocco, who entered the game late, threw four straight incompletions, including missing an open receiver — tailback Khalek Shepherd — down the middle.

Maryland's defense approached the final two minutes differently than the rest of the game.

“In two minutes, it's nothing about field position,” said linebacker Darin Drakeford, who had two sacks. “They have to score, and we set it in our minds they're not going to score. We let our pass rushers loose, our [defensive backs] strapped down and we get them off the field as quickly as we can.”

Maryland had lost four of its previous five games against the Cavaliers (2-5, 0-3 ACC). Virginia has lost five games in a row.

Maryland won largely by holding Virginia quarterback Phillip Sims — making his second career start — in check. A key defensive play came with the Terps leading 24-13 in the fourth quarter. Drakeford stripped Sims, and A.J. Francis recovered the fumble at the Virginia 15. Francis also blocked a field-goal attempt in the second quarter.

Brad Craddock's 28-yard field goal then made it 27-13 with 6:08 left.

Virginia inserted Rocco, a junior, shortly afterward. Rocco led the Cavaliers on an 81-yard scoring drive, capped by a 24-yard scoring pass to tight end Jake McGee, to cut the margin to 27-20 with 4:10 left.

Maryland won despite netting minus-2 yards rushing.

“We've got to get better in the run game,” Edsall said. “There's no doubt about it.”

Maryland played with a patchwork offensive line after starters Bennett Fulper and Sal Conaboy left the game with injuries. Their statuses for next week's North Carolina State game were uncertain.

Without a solid running game, the Terps relied on quarterback Perry Hills (14-for-26 for 237 yards) and Diggs. Diggs tweaked his ankle and back in the game — Marcus Leak took over punt-return duty — but said he is fine.

Diggs, who had a career-best 239 all-purpose yards, immediately put his stamp on the rivalry. He took the opening kickoff and hesitated for a moment near the goal line, as if contemplating whether to down the ball in the end zone. He then went 100 yards for Maryland's first kickoff-return touchdown since Torrey Smith's against N.C. State in 2009. The last Terp to take a kick back 100 yards was Josh Wilson in 2006.