Several dolphin species occur close inshore and in harbours, where underwater noise generated by pile-driving used in wharf construction may constitute an important impact. Such impacts are likely to be greatest on species such as the endangered Hector's dolphin (Cephalorhynchus hectori), which has small home ranges and uses this habitat type routinely. Using automated echolocation detectors in Lyttelton Harbour (New Zealand), we studied the distribution of Hector's dolphins using a gradient sampling design over 92 days within which pile-driving occurred on 46 days. During piling operations, dolphin positive minutes per day decreased at the detector closest to the piling but increased at the mid-harbour detector. Finer-grained analyses showed that close to the piling operation, detections decreased with increasing sound exposure level, that longer piling events were associated with longer reductions in detections, and that effects were long-lasting - detection rates took up to 83 h to return to pre-piling levels.