Yes you can.I have first hand experience about it. I traveled to mexico(Cabo) on F1( students visa) without any problem.You donu2019t need separate visa to travel to Mexico or Canada if you have a valid US visa( could be F1, h1b)If you are worried about immigration, then i donu2019t think you need to worry about it. As you are completely allowed to go to mexico and canada on a valid US visa.Only thing you need to make sure is your passport is not expiring in next 6- 8 months, it could create some issues, otherwise you are good to go.Enjoy MexicoHope this helps.Ps- I have been to mexico on Dec 22nd, 2016.