Most of the EU plus some nordic countries are part of the Schengen Treaty which means that they have no internal customs or immigration between each other. For example if you fly from Madrid to Berlin you would depart and arrive from the domestic terminals. The Schengen Treaty is not part of the EU. The UK and Ireland are 2 EU countries that are not part of the Schengen Treaty.
More Info below
http://www.auswaertiges-amt.de/www/e.../schengen_html