First off, admit you have a problem and get help. If it's interfering with your daily activities, you need to seek help before it get's worse. In my case, it started off rather mildly, but over time led to depression and isolation. I finally talked it over with my parents and went to see a doctor. I was given some drugs (I don't remember what, it was a while ago) which helped to calm me down. This really helped me a lot, it gave me some time off to realize that I was ok and these panic attacks were just that and nothing more. Since then, I have learned to spot them coming on and avoid them. So here is my advice.

Learn to feel them coming
It's not always obvious. Be aware of the warning signs. Elevated pulse, nervousness, pounding heart, sweating, nausea, etc. When you have an attack, think back to how you felt 15 minutes ago and try to spot those feelings next time.

Do Something!
Yes, when you're having a panic attack, the last thing you want to do is to go do something. But it helps. Force yourself to go for a walk. Get up and move around. Don't just sit there and focus on your panic. On the flip side, don't put yourself in a dangerous situation. For example, going for a drive would be a bad idea.

Breath
Panic attacks feed off themselves. The physical effects of a panic attack tend to cause an increase in adrenaline and make the problem worse. Take deep, slow breaths. When you begin to hyperventilate, you decrease the oxygen in your blood. This triggers an automatic panic reflex in your brain which makes things a lot worse. Tell yourself it is a panic attack, and you can breath. Force yourself to take deep breaths, it helps.

Take care of yourself
Avoid stimulants. Eat properly. Get enough sleep. Get plenty of exercise. All these things will help to keep your mind and body healthy.

The key is really in learning to recognize an oncoming attack and prevent it from escalating by focusing on breathing and relaxing. This isn't always easy and a good psychologist can help you to learn to do this. Don't wait until it's gotten bad to seek help, the sooner you can get a handle on the problem, the better.

To address dead's advice a bit, my personal feeling is that whatever works for you is the best. We are all different and we all react to things differently. With that said, I think there's a huge difference between avoiding a problem, and prevening a problem from escalating. Addressing your problem is a very important step, however I do not wish to spend the rest of my life facing my panic. By nature, a panic attack is not rational. My preference is to not spend the rest of my life dealing with panic attacks, and thus I feel that learning to cut them off at the pass is far more preferential to letting them come on so you can face them. When I am in the grip of a panic attack, I cannot reason with myself, sit there, and stay calm. I think this is a key difference between a true panic attack and an anxiety attack, and I think they are often confused. A true panic attack is full fledged panic. You cannot reason. You cannot think. You cannot force yourself to calm down. You are a slave to your panic and cannot function while the attack is going on. This is not something I believe you can sit there and calmly wait out like you can with an anxiety attack. Like I said, preventing a problem from escalating is not the same thing as avoiding the problem.

As for the issue of medication, I think it really depends on the individual. Drugs as a whole are not evil. Yes, many drugs have bad side effects and are not the right answer for everyone. However, some people have severe panic attacks that can interfere with a a persons daily life. For some people, they simply cannot get a grip on their panic, and it leads to a downward spiral causing depression and even self harm. Thus, for some people, I think drugs are needed to help them get a grip on their disorder. For me, I was on a very mild anti-depressant for about a month, and I think this was essential to helping me cope. It gave me a period without the fear and panic to understand that this was just a mental disorder, that nothing serious was wrong with me and that I wasn't dying. Once I gained this perspective, I was able to drop off of the medecine and deal with the problem on my own. I have not had serious panic attacks since.

Like I said, this isn't a black and white issue, and what worked for me may not work for everyone. But I think it's important that you explore your options and find out what works for you. And please, do it before things get to the point where you can't deal with them any longer.