Cities are commonly recognized as the immediate hinterland of ports and play a crucial role in fostering the sustainable development of ports. Therefore, it is imperative to investigate the influence of cities on ports. By employing panel data from 2001 to 2021 for both ports and cities in the Bohai Rim region, this study examines the spatial spillover effect of urban economy on port efficiency using the spatial error model (SEM). The findings show that urban economies have a significant spatial spillover effect on port efficiency, but this effect diminishes across different spatial matrices. In particular, the geographical matrix demonstrates a stronger spatial spillover effect of the urban economy on port efficiency. These research findings help to establish a collaborative mechanism for port-city development and provide useful insights for government management decision-making.