TOKYO—Japanese factories posted their first rise in output in three months in February as resilience in global demand led to a rebound in car production, a welcome sign for policymakers hoping to keep the country’s fragile economic recovery on track. The increase, however, was smaller than market expectations, underscoring the lingering impact of supply chain bottlenecks and other risks such as surging costs of raw materials. Factory output rose 0.1 percent in February from the previous month, official data showed on Thursday, as growing production of cars and transport equipment offset a decline in chemicals. That meant output returned to growth after slipping 0.8 percent in January and 1.0 percent in December. The increase was weaker than a 0.5 percent gain forecast in a Reuters poll of economists. The outlook for the world’s third-largest economy has weakened after energy and commodity prices soared following Russia’s invasion of Ukraine last month. Prices for raw …