Panic attacks are due to anxiety.
A panic attack can sometimes be controlled by deep breathing exercises, as it stops you from hyperventilating which is caused by anxiety. The hyperventilating is what causes the panic attack, so just break the cycle.
The longer term solution is to get therapy and confront what is causing your anxiety.
References :





