Article 77 [source]

Spanish Criminal Code
English translation

1. The provisions of the two preceding articles do not apply when a single act constitutes two or more offenses, or when one offense is a necessary means to commit the other.

2. In the first case, the upper half of the penalty prescribed for the most serious offense shall be applied, without exceeding the sum of the penalties that would be imposed if the offenses were punished separately. When the penalty thus calculated exceeds this limit, the offenses shall be punished separately.

3. In the second case, a penalty greater than that which would have been imposed, in the specific case, for the most serious offense shall be imposed, and which may not exceed the sum of the specific penalties that would have been imposed separately for each of the offenses. Within these limits, the judge or court shall individualize the penalty in accordance with the criteria expressed in Article 66. In any case, the penalty imposed may not exceed the maximum duration provided for in the preceding article.