There's a myriad of ways to do this, but usually through slight of hand, he slipped you the duplicate card which you thought was the ripped up version - when it reality, was a folded version.
Here's a great video of how this is done: http://bit.ly/yWQgQL