Here is a solution that WILL NOT change the order of the lines:
fgrep -x -f file1 file2
Use the join command:
join a.txt b.txt
assuming the files are sorted; if not:
sort a.txt > sorted_a.txt; sort b.txt > sorted_b.txt; join sorted_a.txt sorted_b.txt