Magnesium does not increase blood pressure, it lowers it by acting as a natural calcium channel blocker. But there are many things that raise blood pressure, so magnesium does not work for all causes.
In your case you also mentioned an anxiety feeling. Something else you need to look at when your blood pressure goes up is your pulse rate. A very high blood pressure in conjunction with tachycardia indicates excess epinephrine (adrenaline) release, in which a beta blocker would be a better choice than a calcium channel blocker. An example of a natural beta blocker would be ashwagandha, which is also a natural ACE inhibitor. The reason I mentioned the anxiety is because anxiety can also be triggered by excess epinephrine.