  A general class of W-algebras can be constructed from the affine sl(N)
algebra by (quantum) Drinfeld-Sokolov reduction and are classified by
partitions of N. Surface operators in an N=2 SU(N) 4d gauge theory are also
classified by partitions of N. We argue that instanton partition functions of
N=2 gauge theories in the presence of a surface operator can also be computed
from the corresponding W-algebra. We test this proposal by analysing the
Polyakov-Bershadsky W_3^(2) algebra obtaining results that are in agreement
with the known partition functions for SU(3) gauge theories with a so called
simple surface operator. As a byproduct, our proposal implies relations between
the W_3^(2) and W_3 algebras.
