Updated: Nov 18, 2021
Language teaching has been greatly polarized by this issue, and I can see why. Still, the answer is more complex than a yes or a no.
In my experience, teaching grammar as a tool and in the context of communication is useful to help students learn in a structured manner. It gives them more control over their own learning process. While it is not the natural way to learn a language, we need to consider that, if students have limited exposure to the language -learning in a language center, or with a tutor-, once or twice a week, grammar can be a great learning tool. If students were learning Spanish in Latin America or in Spain, surrounded by native Spanish speakers, the situation changes, but, otherwise, the approach should be more proactive and targeted.
Now, I mentioned grammar as a tool, not an end on itself. Many courses out there teach some grammar and then move on to the next grammar item. They don't give students real chances to put that grammar to good use. That makes no sense in the context of reaching fluency, grammar should be a tool used to build fluency by using it to make speaking and listening interactions. all done in a way that students find meaningful and useful. The same way, many students come to me complaining they are stuck with language apps. They don't understand the language behind it, as these apps basically offer mechanical drills that don't mean much to the students.
In summary, grammar can help you grow your fluency, if used the right way.