Monolayer transition metal dichalcogenide heterojunctions, including vertical and lateral p–n junctions, have attracted considerable attention due to their potential applications in electronics and optoelectronics. Lattice-misfit strain in atomically abrupt lateral heterojunctions, such as WSe2–MoS2, offers a new band-engineering strategy for tailoring their electronic properties. However, this approach requires an understanding of the strain distribution and its effect on band alignment. Here, we study a WSe2–MoS2 lateral heterojunction using scanning tunnelling microscopy and image its moiré pattern to map the full two-dimensional strain tensor with high spatial resolution. Using scanning tunnelling spectroscopy, we measure both the strain and the band alignment of the WSe2–MoS2 lateral heterojunction. We find that the misfit strain induces type II to type I band alignment transformation. Scanning transmission electron microscopy reveals the dislocations at the interface that partially relieve the strain. Finally, we observe a distinctive electronic structure at the interface due to hetero-bonding.