The National Markets and Competition Commission (CNMC) has handed down fines totalling €15 million ($20.3m) for what they described in a statement as "a very serious infraction" of the rules on the acquisition of football-related rights.
Mediapro were fined €6.5 million, while Real Madrid have been ordered to pay €3.9 million and Barcelona €3.6 million.
In addition, Sevilla have been fined €900,000 and Racing Santander €30,000.
The clubs all signed four-year contracts with Mediapro to broadcast their domestic league and cup matches, when the maximum duration of such a deal was limited to three years by Spain's Competition Commission in 2010.
They explained that the size of the fine varied depending on the individual contracts signed between Mediapro and the respective clubs.
According to a table put together by the consultancy firm Deloitte, Real Madrid became the first sports club in the world to earn more than €500 million in 2011–12.
Barcelona were named as the world's second richest club on the same list with income of €483 million.
Unlike in other European countries, there is no collective television rights deal for clubs in Spain.
Instead, clubs negotiate their own deals with broadcasters, a situation that allows Barcelona and Real Madrid to earn vastly superior sums compared to the rest of the country.
Spanish football was for a number of years marred by a television rights war, with a number of clubs agreeing deals with Mediapro while others entered into partnership with Sogecable, part of Spain's biggest media group Prisa, the owners of the subscription channel Canal+.