We estimate the impact of renewable energy sources on the merit order and the wholesale price in Spain. We use a structural vectorautoregressive model for the merit order of production and argue that wind and solar production are exogenous to the system. As expected the overall effect is negative for the wholesale price and the produced quantities of most generation technologies. The estimated impact, however, is biggest for mid-merit plants. This finding sheds light on the theoretical discussion about which power plants are affected most by renewable energy sources. The effect is also mainly driven by wind power. Solar energy increases wholesale prices as peak plants enlarge their production with more solar power.