According to one embodiment, a strain sensor includes: a base; a strain sensing element; a magnetic field sensing element; and a processing unit. The strain sensing element includes a first magnetic layer having a first magnetization; a second magnetic layer having a second magnetization; and a first intermediate layer. In the strain sensing element an angle between a direction of the first magnetization and a direction of the second magnetization changes in accordance with a strain. The magnetic field sensing element includes a third magnetic layer having a third magnetization; a fourth magnetic layer having a fourth magnetization; and a second intermediate layer. In the magnetic field sensing an angle between a direction of the third magnetization and a direction of the fourth magnetization changes in accordance with a magnetic field.根據一實施例,應變感測器包括:基座;應變感測元件;磁場感測元件;以及處理單元。應變感測元件包括具有第一磁化強度(magnetization)的第一磁性層;具有第二磁化強度的第二磁性層;以及第一中間層。在應變感測元件中,第一磁化強度的方向和第二磁化強度的方向之間的角度根據應變而改變。磁場感測元件包括具有第三磁化強度的第三磁性層;具有第四磁化強度的第四磁性層;以及第二中間層。在磁場感測元件中,第三磁化強度的方向和第四磁化強度的方向之間的角度根據磁場而改變。