We report on a measurement of the cosmic ray energy spectrum with the IceTop air shower array, the surface component of the IceCube Neutrino Observatory at the South Pole. The data used in this analysis were taken between June and October, 2007, with 26 surface stations operational at that time, corresponding to about one third of the final array. The fiducial area used in this analysis was 0.122 km^2. The analysis investigated the energy spectrum from 1 to 100 PeV measured for three different zenith angle ranges between 0{deg} and 46{deg}. Because of the isotropy of cosmic rays in this energy range the spectra from all zenith angle intervals have to agree. The cosmic-ray energy spectrum was determined under different assumptions on the primary mass composition. Good agreement of spectra in the three zenith angle ranges was found for the assumption of pure proton and a simple two-component model. For zenith angles {theta} < 30{deg}, where the mass dependence is smallest, the knee in the cosmic ray energy spectrum was observed between 3.5 and 4.32 PeV, depending on composition assumption. Spectral indices above the knee range from -3.08 to -3.11 depending on primary mass composition assumption. Moreover, an indication of a flattening of the spectrum above 22 PeV were observed.