Digital potentiometers function in the same way of having three pins and varying resistance between those pins. But it is done discretely (not discreetly) with an array of resistors. Depending on the resistance desired, switches are opened or closed to switch them from one portion of the circuit to another.
A digital potentiometer (also called a resistive digital-to-analog converter, or informally a digipot) is a digitally-controlled electronic component that mimics the analog functions of a potentiometer. It is often used for trimming and scaling analog signals by microcontrollers.