China has unexpectedly cut a key interest rate for the first time in almost two years as official figures showed its economic growth had slowed.