A method for performing graphics Z-compare and pixel merge operations, for use in a Z-buffering system to remove hidden surfaces when displaying a three-dimensional image, is provided. The data processing system includes a main memory for storing data and instructions, and a graphics execution unit for executing graphics instructions. The graphics execution units are connected to an instruction sequencer, which provides instructions and data operands to the execution units, via a communications bus. In response to receiving Z-compare and pixel merge instructions, the graphics execution unit compares one or more Z-axis coordinates within a first data operand to one or more Z-axis coordinates in a corresponding bit-field position within a second data operand to determine a relative Z-axis position of each of the one or more pixels associated with the one or more Z-axis coordinates. A pixel compare result bit-vector uniquely representing the possible results of comparing each of the corresponding bit-field positions is stored in a register. Utilizing the pixel compare result vector, the graphics execution unit executes a pixel merge instruction, to selectively store the pixels in an image buffer.