It didn’t solve the problem, meaning, unless you are willing to lock down indefinitely, the virus will come back. So in the pedantic sense you are right, lockdowns work, but clearly are not a solution.
Lockdown works; Spain would have been fine by now if they were more careful with opening (not allowing the British in for instance). But alas it is worse than ever and there is no stomach for another lockdown so people wear masks but restaurants are crowded every day and there are few travel restrictions so...
Madrid in particular did pretty poorly at this.
Additionally, their economy is so dependent on tourism that they felt they needed to open back up to avoid ruination.
This lead to loads more cases, coupled with pandemic fatigue and here we are.