The West Baram Line separates NW Borneo's two petroleum systems. Oligocene sandstone and Lower Miocene carbonate reservoirs of the gas-prone Luconia system lie SW of that line. Northeast of the West Baram Line, the oil-rich Baram-Balabac Basin produces from Middle Miocene to Early Pliocene sandstones deposited in a foreland basin on the western side of the mountainous interior of Borneo. On the present-day shelf exploration efforts spanning nearly four decades have focused on the Champion and Baram deltas and associated extensional growth fault structures. Many of these structures have experienced youthful inversion owing to ongoing tectonic shortening. Recent discoveries prove this petroleum system extends into deep water beyond the modern shelf edge where an active fold-thrust belt has formed above autochthonous rifted continental crust of the Dangerous Grounds province in the South China Sea. New regional mapping (c. 100 000 km2) integrating seismic, borehole and gravity data shows that the Baram-Balabac Basin is segmented into four structural domains whose boundary zones trend NW-SE similar to the strike of the West Baram Line. Domain boundaries appear to control the position of the basin's palaeoshelf edges, turbidite depositional systems, major unconformities and the position of the basin's largest fields. These observations suggest that the domain boundaries are the expression of deep structures, probably within the underlying rifted continental crust. Two of the domain boundaries can be projected onshore to align with fault systems separating contrasting geological elements indicating they represent features of tectonic interest. The onshore geology of NW Borneo represents the early history of the Baram-Balabac Basin. The onshore geology is reviewed and new outcrop, biostratigraphic and palaeomagnetic data from Sabah are discussed in light of current models for the region's tectonic evolution. A hybrid model is proposed in which the Baram-Balabac Basin post-dates the Sarawak Orogeny. The Sarawak Orogeny, which appears to be more regionally extensive than previously believed, is attributed to Eocene to Early Oligocene collision of the Dangerous Grounds and Reed Bank with Sabah and Palawan. In the proposed model Oligo-Miocene subduction of oceanic crust under NW Borneo is minimal. The Sabah Orogeny and younger inversion events are related to underthrusting of the Dangerous Grounds driven by both the opening of the South China Sea and by NW-directed subduction beneath SE Sabah in the Semporna-Dent Peninsula. In this context the structural complexity of the Baram-Balabac foreland basin reflects the adjustment of deep crustal blocks to far-field tectonic stress.