The gain was stronger than expected, though the impact of President Trump’s tariffs and other policies on the labor market has yet to play out.