In the second half of this season, the Yankees often have looked as if they need an offensive spark. During the past three days, they got one.

Starlin Castro returned to the lineup Friday night after coming off the disabled list and looks every bit the formidable hitter he was when the Yankees were scoring more.

Castro, who has done two DL stints this season for a right hamstring strain — the second likely because he rushed back from the first one — performed well at the plate against the Mariners this weekend. In Sunday’s 10-1 win over Seattle, he went 4-for-4 out of the second spot in the batting order with an RBI and two runs scored. In the three-game series, he went 6-for-12 with two extra-base hits and three RBIs.

Castro rediscovered his groove at the plate in a seven-game minor-league rehab assignment in which he hit .333 and made certain the hamstring was sound.

“I feel right back,” said Castro, who was hitting .313 when he first went on the DL and had to miss the All-Star Game because of it. “Those games at Triple-A [Scranton/Wilkes-Barre] made me feel like I did at the start of the season. I feel real ly good at the plate.”

Castro’s return has lengthened the lineup.

“We think it’s an experienced hitter who’d had a great first half for us,” manager Joe Girardi said. “He added a lot today. We think he’s going to help us out a lot.”

advertisement | advertise on newsday

Castro doubled in the first and added singles in the second, third and sixth before being removed from the rout late in the game. His second hit required him to beat out a grounder to third baseman Kyle Seager, who made a high throw to first. He also scored from second on a single and advanced on a wild pitch, testing his hamstring and experiencing no discomfort. “I don’t feel it at all,” he said. “I was running pretty good there.”

He missed a total of 44 games during the two DL trips and doesn’t want to miss any more. “The games right now are important for us,” he said. “I want to be playing in them. I’m glad I’m back.”