Bets will no longer be able to sponsor jerseys or have the right to name a stadium in Spain from the start of the following season.
The ban follows legal approval under the Royal Spanish Advertising Decree, which currently only allows a four-hour advertisement window for betting companies.
The law proposed by Spanish consumer minister Alberto Garson will still be stamped by the European Union in Brussels, but this may be a formality. Garson said they would be available for the new LaLiga season.
Spain is quick to pass new laws and has banned company sponsors from appearing on jerseys for youth teams. Second and third grades LaLiga were hit by a series of game manipulation scandals.
The advertising ban will be the most difficult in the top league. Eight teams represent gambling companies as the main sponsors – Valencia, Alaves, Leganes, Granada, Mallorca, Seville, Osasuna and Levante