By has dozens of meanings. Here we describe 2 of the less commonly explained ones.

Remember that after preposition the verb is used in gerund form.

1.Means ( i.e. mediante)

By closing the window, I managed to stop the draft- Cerrando la ventana conseguí parar la corriente

What do you mean by (saying) that?- ¿Qué quieres decir con eso?

2. Condition/ as a result of (i.e. si)

By trying to fix the computer, you'll only break it- Con intentar arreglar el ordenador, sólo lo romperás.