The nuclear bulge is a region with a radius of about 200 parsecs around the centre of the Milky Way. It contains stars with ages ranging from a few million years to over a billion years, yet its star-formation history and the triggering process for star formation remain to be resolved. Recently, episodic star formation, powered by changes in the gas content, has been suggested. Classical Cepheid variable stars have pulsation periods that decrease with increasing age, so it is possible to probe the star-formation history on the basis of the distribution of their periods. Here we report the presence of three classical Cepheids in the nuclear bulge with pulsation periods of approximately 20 days, within 40 parsecs (projected distance) of the central black hole. No Cepheids with longer or shorter periods were found. We infer that there was a period about 25 million years ago, and possibly lasting until recently, in which star formation increased relative to the period of 30-70 million years ago.