The economy grew at an annual pace of 7% over the quarter, beating analysts’ forecasts, though its volatile stock markets took a sharp dive in a reminder of the threats to Beijing’s efforts to direct the economy out of a slowdown.

The National Bureau of Statistics called the stock markets key to economic stability as it released the figures but China’s main Shanghai index closed down 3%.