Solar flares are caused by the sudden release of magnetic energy stored near sunspots. They release 10(29) to 10(32) ergs of energy on a timescale of hours. Similar flares have been observed on many stars, with larger 'superflares' seen on a variety of stars, some of which are rapidly rotating and some of which are of ordinary solar type. The small number of superflares observed on solar-type stars has hitherto precluded a detailed study of them. Here we report observations of 365 superflares, including some from slowly rotating solar-type stars, from about 83,000 stars observed over 120 days. Quasi-periodic brightness modulations observed in the solar-type stars suggest that they have much larger starspots than does the Sun. The maximum energy of the flare is not correlated with the stellar rotation period, but the data suggest that superflares occur more frequently on rapidly rotating stars. It has been proposed that hot Jupiters may be important in the generation of superflares on solar-type stars, but none have been discovered around the stars that we have studied, indicating that hot Jupiters associated with superflares are rare.