D.C. United midfielder Luciano Acosta (10) works the ball against New York City FC defender Frederic Brillant (13) during United’s 2-1 over NYCFC at RFK Stadium on Saturday. (Photo by Jonathan Newton/The Washington Post)

D.C. United unwrapped the 2017 schedule this winter to find four of the first five matches at home – a prime occasion, with the core of an interlocked roster in place, to get the jump on MLS’s Eastern Conference.

A slow start and three imminent trips, however, heightened the importance of securing all three points on that fourth date on East Capitol Street on Saturday.

United didn’t let the opportunity escape. Lloyd Sam cracked open a scoreless deadlock early in the second half and played a part in Luciano Acosta’s second goal in two weeks during a 2-1 victory over New York City FC in front of 18,855 at RFK Stadium.

“It’s weird to think this early in the season the urgency is picking up,” midfielder Jared Jeffrey said, “but we needed to get it right.”

After settling for one point over the first two home outings, United (2-2-1) won its second straight at RFK under similar circumstances – a two-goal lead followed by an anxious, but gratifying, finish.

Points at home are critical because points on the road are historically difficult to come by for Ben Olsen’s crew, which will visit the New York Red Bulls, New England Revolution and expansion Atlanta United before resuming the home campaign May 6.

“We’ve had to roll with the punches, and we got punched pretty hard in the beginning of the season,” goalkeeper Bill Hamid said. “But we started throwing some punches of our own.”

A month after a 4-0 defeat at Yankee Stadium, Hamid was spectacular for the second straight week. With a two-goal lead, he extended to his right in the 82nd minute to thwart David Villa’s 25-yard effort. On the rebound, he stuffed Jack Harrison’s clear bid from close range.

Villa scored two minutes later, but the overall recovery against NYCFC – and three points — brought immense satisfaction.

Said Olsen: “It was pretty fresh in our minds, the whooping they put on us there.”

After an uneventful first half, United went ahead in the 53rd minute when a seemingly harmless back pass to NYCFC defender Frederic Brillant turned into a sudden scoring opportunity.

Sam didn’t give up on the ball and, when it took a baby hop over Brillant’s foot, Sam pounced. He was in clean on goalkeeper Sean Johnson and finished into the right side of the net for his first goal of the year.

“Let me just run this down and see what happens,” said Sam, who marked his 100th career regular season start in MLS. “Thank God we’ve got a bumpy field and he ended up missing the ball. I thought, ‘Oh my God, I’m in here.’ The rest is history.

“We weren’t necessarily generating so much, so sometimes you try to make something happen in other ways.”

In the 73rd minute, Acosta used his tight footwork to dance into space in the attacking third of the field and set up Sam on the right for a solid bid to the far side. Johnson made a splendid reflex save, but Acosta followed the path of the airborne ball and, on a short hop, snapped a six-yard one-timer into the near corner.

NYCFC (2-2-1) hoarded possession in a concerted effort to get back into the match, but with Jeffrey admirably filling in for suspended defensive midfielder Marcelo Sarvas and Bobby Boswell in sync in his second straight start partnering with center back Steve Birnbaum, United kept its shape and composure.

D.C. didn’t concede quality opportunities until the last 10 minutes, when the anxiety level rose on the bench area and among nervous supporters.

After Hamid’s back-to-back gems, Villa halved the margin in the 84th with a 12-yard one-timer to the near corner, set up by Thomas McNamara’s cross. The former Spanish national team star has scored seven goals (plus three assists) in seven matches against United.

Hamid was not seriously tested again.

“You know me: I like a real group effort,” Olsen said. “Everybody played a part in this, everybody played up to their standard and gave everything they had.”