According to an embodiment, a pressure sensor includes a support part, a flexible membrane part, and a magnetoresistive element. The flexible membrane part is supported by the support part, and includes a first region and a second region with rigidity lower than rigidity of the first region. The magnetoresistive element is provided on the membrane part, and includes a first magnetic layer, a second magnetic layer, and a spacer layer provided between the first magnetic layer and the second magnetic layer.