With the rapid development of synthetic aperture radar (SAR) technology, SAR remote sensing has a wide range of applications in fields such as marine surveillance and sea rescue. Currently, the SAR ship detection model based on deep learning suffers from the problems of low detection in real-time and low detection accuracy. In order to solve the above problems, this paper proposes a lightweight SAR ship detection network (EGTB-Net) based on transformer and feature enhancement. Firstly, we design a novel Ghost-ECA model as the backbone network of EGTB-Net, which reduces the number of parameters of the model and enhances the ability to identify key feature information at the same time. Then, we incorporate the transformer block in the backbone network to capture long-range dependencies, enrich contextual information, and improve the network's ability to capture different types of local information. Finally, we adopt a new SIoU loss function, which is used to solve the direction problem of mismatch between the real frame and the predicted frame and improve the network's ability to localize ship targets. The experimental results on the SAR-Ship-Dataset show that the mean average precision (mAP) of the method is 94.83%, the detection speed is 61 FPS, and the model size is only 5.94 M, while the model has excellent anti-interference ability.Index Terms-synthetic aperture radar (SAR), ship detection, feature enhancement, complex background, lightweight network.