This test applies to 2x2 contingency tables with paired samples. These could be matched pairs of subjects or a pair of measurements on the same set of subjects  e.g. before and after treatment). As with Fisher's exact test we take the 2x2 table:

Y 
Total 

With Y 
Without Y 

Group 1 
a 
b 
a+b 
Group 2 
c 
d 
c+d 
Total 
r 
Nr 
N 
but this time compute a simple chisquare statistic (with Yates' correction) having 1 df:
The null hypothesis is pb=pc.
Note that only the terms of one diagonal are used in this computation and is only appropriate for b+c>25. In practice this measure is redundant since the table can be analyzed using the Binomial distribution to provide exact probabilities, and this is generally the approach used in software packages. This test is a special case of Cochran's Q test, which in turn is a special case of the Friedman ANOVA test applied to binary data.