This paper proposes a novel fragile watermarking algorithm, designated as the compression-watermarking algorithm (CWA), which inserts watermark information in a JPEG image by modifying the last nonzero coefficient in each discrete cosine transform (DCT) quantized block. The proposed algorithm not only provides an authentication capability, but also decreases the size of JPEG compressed-domain images. The experimental results show that CWA has virtually no impact on the visual quality of the watermarked images and is highly sensitive to image modifications. Furthermore, it is found that CWA reduces the size of watermarked image by as much as 6.3% when applied to the watermarking of standard JPEG test images. Therefore, CWA provides a feasible solution for image authentication and data reduction in DCT-based domains such as JPEG and MPEG-family coders/decoders.