Having lost a rain hit series of five one-day internationals 3-0, the Black Caps continued to toil in Galle despite half-centuries from Brendon McCullum and Daniel Flynn.
The hosts responded with nine for one by the close of play as Tim Southee removed debutant Dimuth Karunaratne for a duck.
New Zealand skipper Ross Taylor won the toss and after electing to bat saw his openers race the score along to 29 in the sixth over. But they were soon in trouble when Shaminda Eranga made a double breakthrough in the same over.
Martin Guptill edged a full delivery to Angelo Matthews at second slip and two balls later Eranga got Kane Williamson fencing at a shorter ball that Tharanga Paranavitana juggled before holding onto at first slip.
It got worse for New Zealand when Taylor (nine) thinned an inside edge from a Kulasekara off-cutter onto his stumps. McCullum and Flynn combined in a 90-run stand for the fourth wicket until Rangana stole back the initiative in the afternoon session.
The veteran slow left-armer produced his best to get McCullum, who had been untroubled in reaching 68 with eight fours and a pair of sixes. But when the opener went to drive at a full delivery Rangana got just enough grip and turn to take the top of his off stump.
Herath then prised out James Franklin, who took 43 balls to eke out three, lbw when the ball straightened into his pads. Flynn (53) reached his half-century soon after, from 135 balls, but his resolute stay was ended by Herath with the final ball before tea, getting a thick edge which wicketkeeper Prasanna Jayawardene pouched.
Doug Bracewell and Kruger van Wyk put on 26 before the former edged Herath to Mahela Jayawardene at slip, and the spinner then bowled Van Wyk (28) to complete his five-wicket haul.
Southee made 16 before becoming Eranga's third victim and Jeetan Patel and Trent Boult put on 14 for the last wicket only for Nuwan Kulasekara to bowl the latter with the second delivery with the new ball. Karunaratne's first Test innings lasted only three runless deliveries but nightwatchman Suraj Randiv saw Sri Lanka through the remainder of their five-over stint unharmed.