In this paper, natural convection heat transfer in an inclined square cavity filled with pure air (Pr=0.71) was numerically analyzed with the lattice Boltzmann method. The heat source element is symmetrically embedded over the center of the bottom wall, and its temperature varies sinusoidally along the length. The top and the rest part of the bottom wall are adiabatic while the sidewalls are fixed at a low temperature. The influences of heat source length, inclination angle, and Rayleigh number (Ra) on flow and heat transfer were investigated. The Nusselt number (Nu) distributions on the heat source surface, the streamlines, and the isotherms were presented. The results show that the inclination angle and heat source length have a significant impact on the flow and temperature fields and the heat transfer performance at high Rayleigh numbers. In addition, the average Nu firstly increases with gamma and reaches a local maximum at around gamma = 45 degrees, then decreases with increasing gamma and reaches minimum at gamma = 180 degrees in the cavity with epsilon = 0.4. Similar behaviors are observed for epsilon = 0.2 at Ra = 10(4). Moreover, nonuniform heating produces a significant different type of average Nu and two local minimum average Nu values are observed at around gamma = 45 degrees and gamma = 180 degrees for Ra = 10(5) in the cavity with epsilon = 0.2.