Late-cycle direct injection of natural gas allows a diesel-like combustion but with a significant reduction in CO2 emissions. High pressure direct injection (HPDI) technology uses a small diesel injection to ignite a non-premixed natural gas jet. This paper evaluates the impacts of changes in natural gas composition on the performance of a heavy-duty HPDI engine and on the implementation of a novel accelerometer-based sensor system to correct for the changes in fuel composition. The composition of natural gas varies significantly depending on source, suppliers, and seasons; this can significantly impact engine performance through changing both its auto-ignition properties (knocking propensity) and its energy content. For HPDI, unlike premixed charge engines, the main sensitivity is to energy density; the knocking potential of the fuel is not a significant barrier. A modern 6-cylinder heavy-duty engine, based on a Euro-VI diesel platform but equipped with an HPDI fueling system, was tested on an engine test bed with varying NG fuel compositions. The engine was fitted with accelerometers and an advanced signal processing algorithm to reconstruct the pressure trace for individual cylinders in near-real time. The output from the sensor system provided a good representation of the apparent heat release rate (AHRR). The feedback from the sensor system was used to adjust the fueling commands to maintain a target torque and combustion phasing for the various fuel compositions. Without correction, engine power and emissions varied with changes in natural gas composition. The accelerometer-based control system was found to be able to adjust the fueling timing and duration so that the engine power and apparent heat release rate of the combustion event were constant across all fuel compositions. The changes in engine emissions with the different fuels were quantified with and without the fueling correction implemented. The compensation also substantially reduced the impact of fuel composition variations on engine-out emissions. This system provides an option for a more fuel-tolerant and robust natural gas engine for heavy-duty vehicles.