the best way is to masturbate in the morning, and then masturbate when you get an erection, and can spare the time. it's fun, it's easy, and it saves embarrassment. actually, what is truly embarrassing about an erection? all it means, is that you are physically ready to reproduce. it's not like you are the only guy it is happening to, or like nobody else knows it is happening.
I guess it is part of the human condition to feel inordinately embarrassed about everyday normal functions.
you can think of something very anti-erotic. i.e. old people, cold showers, a person of a sex your not attracted to, sports. but you have to be very detailed in your mind. also, you can always just hide it. i sometimes tuck it into my waistband like they talk about in "superbad." just make sure no one is looking, or better yet no one is around when you tuck.
all it is, is nature's way of telling you you are ready to reproduce.
all young men get them. that's just the way it is. there is no harm or shame in it. all it means is that you have a healthy flow of blood. it is not voluntary.
at your age, it can be caused by your pants, a thought, a breeze, or nothing at all. this is really not something you want to stop, so enjoy. if you really, really want to prevent them, masturbation is a good solution.