In this work, we propose an algorithm for joint calibration and axes alignment of a 3-axis accelerometer and a 3-axis magnetometer. The proposed algorithm applies when the two sensors are fixed on the same rigid platform. It achieves accurate calibration without requiring any external piece of equipment like a turntable for the accelerometer or Gauss magnetic chamber and Maxwell coils setup for the magnetometer. The efficiency and accuracy of the proposed algorithm are evaluated using experimental data.