The Ecuadorian forearc, formed by the accretion of oceanic plateaus and island arcs and subduction of an aseismic ridge, records a history of long-lived subduction. The modern system includes subduction of the Carnegie Ridge and seamounts, young forearc coastal ranges, and translation of a forearc sliver from oblique subduction of the Nazca Plate beneath South America. The margin has experienced multiple large megathrust earthquakes and exhibits slow slip events and earthquake swarms. We present results from joint tomographic inversion of local earthquakes for 3D velocity structure and earthquake location. Our joint inversion uses local earthquakes recorded by permanent stations and dense seismic temporary networks deployed near the coast after the 2016 Mw 7.8 Pedernales megathrust rupture and across the entire northern forearc into the foothills of the Andes in 2021-2022. Our results show that the distribution of seismicity and megathrust rupture is controlled by both inherited and modern structures in the upper plate forearc and subducting Nazca Plate. Forearc sedimentary basins observed as low velocities (Vp < 5.8 km/s, Vs < 3.2 km/s) are dissected by forearc basement highs observed as fast velocities (Vp 6.6-7.2 km/s, Vs. 3.6-4.0 km/s). Localized deep depocenters adjacent to basement highs preserve older sedimentary sections beneath younger forearc deposits. Differences in velocity allow discrimination between oceanic plateau basement associated with the Piñón terrane beneath the forearc and accreted island arc terranes along the eastern forearc boundary with the Andes. Along the coast, basement velocities are consistent with a hydrated upper plate. We observe an apparent transient in Vp/Vs (higher to lower) in the upper plate after the 2016 megathrust rupture, representing a transient flux of fluids from the subducting slab into the upper plate triggered by the earthquake. We observe variable thickness of the subducting Nazca plate from ~10 km north of the Carnegie Ridge reaching 20-25 km where the Carnegie Ridge subducts beneath the forearc. Lateral velocity variations in the subducting plate indicate heterogeneity along strike and dip associated with magmatic evolution of the ridge. High velocity domains at depth correlate with seamounts and subducted relief along the Carnegie Ridge. A low-velocity zone marks the boundary between the subducting and overriding plates. The downdip termination of the Pedernales megathrust rupture coincides with structure of the Carnegie Ridge and along strike changes in the plate interface. The downdip edge of the rupture occurs where the low velocity zone is absent and the subducting Carnegie Ridge intersects the overlying mantle wedge. Earthquakes located with the joint inversion focus into tight clusters largely controlled by relief at the top of the subducting slab and basement structure in the overriding plate. Along the coast, seismicity shallows from south to north across the east-west striking Canandé Fault. South of the fault, seismicity locates predominantly within the subducting plate and plate interface. To the north, seismicity concentrates within the plate interface and upper plate. The northward shift in hypocenter depths and an offset in the eastern limit of thick subducting Nazca plate across the Canandé fault marks a significant transition in the forearc across the fault.