A passport with six months validity is required to enter and depart Peru. Migraciones (Immigration) authorities may also require evidence of return/onward travel. Be sure your date and place of entry is officially documented by Migraciones, whether you arrive at a port, airport or land border. Retain the record of your entry, as you will need it when you depart.
Your length of approved stay will be determined by border officials at the time of entry, and can range from 30 to 183 days. Extensions for tourists are not usually approved, and overstays result in fines.